summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7')
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h139
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h140
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h165
-rw-r--r--c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h71
4 files changed, 0 insertions, 515 deletions
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h
deleted file mode 100644
index 9c0c2e4502..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/audio.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*---------------------------------------------------------------------------------
- ARM7 audio control
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef AUDIO_ARM7_INCLUDE
-#define AUDIO_ARM7_INCLUDE
-
-//---------------------------------------------------------------------------------
-// Sound (ARM7 only)
-//---------------------------------------------------------------------------------
-#ifndef ARM7
-#error Audio is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/arm7/serial.h>
-
-
-#define SOUND_VOL(n) (n)
-#define SOUND_FREQ(n) ((-0x1000000 / (n)))
-#define SOUND_ENABLE BIT(15)
-#define SOUND_REPEAT BIT(27)
-#define SOUND_ONE_SHOT BIT(28)
-#define SOUND_FORMAT_16BIT (1<<29)
-#define SOUND_FORMAT_8BIT (0<<29)
-#define SOUND_FORMAT_PSG (3<<29)
-#define SOUND_FORMAT_ADPCM (2<<29)
-#define SOUND_16BIT (1<<29)
-#define SOUND_8BIT (0)
-
-#define SOUND_PAN(n) ((n) << 16)
-
-#define SCHANNEL_ENABLE BIT(31)
-
-//---------------------------------------------------------------------------------
-// registers
-//---------------------------------------------------------------------------------
-#define SCHANNEL_CR(n) (*(vuint32*)(0x04000400 + ((n)<<4)))
-#define SCHANNEL_VOL(n) (*(vuint8*)(0x04000400 + ((n)<<4)))
-#define SCHANNEL_PAN(n) (*(vuint8*)(0x04000402 + ((n)<<4)))
-#define SCHANNEL_SOURCE(n) (*(vuint32*)(0x04000404 + ((n)<<4)))
-#define SCHANNEL_TIMER(n) (*(vint16*)(0x04000408 + ((n)<<4)))
-#define SCHANNEL_REPEAT_POINT(n) (*(vuint16*)(0x0400040A + ((n)<<4)))
-#define SCHANNEL_LENGTH(n) (*(vuint32*)(0x0400040C + ((n)<<4)))
-
-#define SOUND_CR (*(vuint16*)0x04000500)
-#define SOUND_MASTER_VOL (*(vuint8*)0x04000500)
-
-//---------------------------------------------------------------------------------
-// not sure on the following
-//---------------------------------------------------------------------------------
-#define SOUND_BIAS (*(vuint16*)0x04000504)
-#define SOUND508 (*(vuint16*)0x04000508)
-#define SOUND510 (*(vuint16*)0x04000510)
-#define SOUND514 (*(vuint16*)0x04000514)
-#define SOUND518 (*(vuint16*)0x04000518)
-#define SOUND51C (*(vuint16*)0x0400051C)
-
-
-/*---------------------------------------------------------------------------------
- microphone code based on neimod's microphone example.
- See: http://neimod.com/dstek/
- Chris Double (chris.double@double.co.nz)
- http://www.double.co.nz/nintendo_ds
----------------------------------------------------------------------------------*/
-
-
-/*---------------------------------------------------------------------------------
- Read a byte from the microphone
----------------------------------------------------------------------------------*/
-u8 MIC_ReadData(void);
-
-/*---------------------------------------------------------------------------------
- Fill the buffer with data from the microphone. The buffer will be
- signed sound data at 16kHz. Once the length of the buffer is
- reached, no more data will be stored. Uses ARM7 timer 0.
----------------------------------------------------------------------------------*/
-void StartRecording(u8* buffer, int length);
-
-/*---------------------------------------------------------------------------------
- Stop recording data, and return the length of data recorded.
----------------------------------------------------------------------------------*/
-int StopRecording(void);
-
-/* This must be called during IRQ_TIMER0 */
-void ProcessMicrophoneTimerIRQ(void);
-
-void PM_SetAmp(u8 control);
-
-//---------------------------------------------------------------------------------
-// Turn the microphone on
-//---------------------------------------------------------------------------------
-static inline void MIC_On(void) {
-//---------------------------------------------------------------------------------
- PM_SetAmp(PM_AMP_ON);
-}
-
-
-//---------------------------------------------------------------------------------
-// Turn the microphone off
-//---------------------------------------------------------------------------------
-static inline void MIC_Off(void) {
-//---------------------------------------------------------------------------------
- PM_SetAmp(PM_AMP_OFF);
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h
deleted file mode 100644
index 57cba7c1ef..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/clock.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*---------------------------------------------------------------------------------
-
- ARM7 realtime clock
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef ARM7_CLOCK_INCLUDE
-#define ARM7_CLOCK_INCLUDE
-
-
-#ifndef ARM7
-#error The clock is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#include <nds/arm7/serial.h>
-
-// RTC registers
-#define WRITE_STATUS_REG1 0x60
-#define READ_STATUS_REG1 0x61
-
-/*
- Status Register 1
- 0 W Reset (0=Normal, 1=Reset)
- 1 R/W 12/24 hour mode (0=12 hour, 1=24 hour)
- 2-3 R/W General purpose bits
- 4 R Interrupt 1 Flag (1=Yes) ;auto-cleared on read
- 5 R Interrupt 2 Flag (1=Yes) ;auto-cleared on read
- 6 R Power Low Flag (0=Normal, 1=Power is/was low) ;auto-cleared on read
- 7 R Power Off Flag (0=Normal, 1=Power was off) ;auto-cleared on read
- Power off indicates that the battery was removed or fully discharged,
- all registers are reset to 00h (or 01h), and must be re-initialized.
-*/
-#define STATUS_POC (1<<7) // read-only, cleared by reading (1 if just powered on)
-#define STATUS_BLD (1<<6) // read-only, cleared by reading (1 if power dropped below the safety threshold)
-#define STATUS_INT2 (1<<5) // read-only, INT2 has occured
-#define STATUS_INT1 (1<<4) // read-only, INT1 has occured
-#define STATUS_SC1 (1<<3) // R/W scratch bit
-#define STATUS_SC0 (1<<2) // R/W scratch bit
-#define STATUS_24HRS (1<<1) // 24 hour mode when 1, 12 hour mode when 0
-#define STATUS_RESET (1<<0) // write-only, reset when 1 written
-
-#define WRITE_STATUS_REG2 0x62
-#define READ_STATUS_REG2 0x63
-/*
- Status Register 2
- 0-3 R/W INT1 Mode/Enable
- 0000b Disable
- 0x01b Selected Frequency steady interrupt
- 0x10b Per-minute edge interrupt
- 0011b Per-minute steady interrupt 1 (duty 30.0 secomds)
- 0100b Alarm 1 interrupt
- 0111b Per-minute steady interrupt 2 (duty 0.0079 secomds)
- 1xxxb 32kHz output
- 4-5 R/W General purpose bits
- 6 R/W INT2 Enable
- 0b Disable
- 1b Alarm 2 interrupt
- 7 R/W Test Mode (0=Normal, 1=Test, don't use) (cleared on Reset)
-*/
-#define STATUS_TEST (1<<7) //
-#define STATUS_INT2AE (1<<6) //
-#define STATUS_SC3 (1<<5) // R/W scratch bit
-#define STATUS_SC2 (1<<4) // R/W scratch bit
-
-#define STATUS_32kE (1<<3) // Interrupt mode bits
-#define STATUS_INT1AE (1<<2) //
-#define STATUS_INT1ME (1<<1) //
-#define STATUS_INT1FE (1<<0) //
-
-// full 7 bytes for time and date
-#define WRITE_TIME_AND_DATE 0x64
-#define READ_TIME_AND_DATE 0x65
-
-// last 3 bytes of current time
-#define WRITE_TIME 0x66
-#define READ_TIME 0x67
-
-#define WRITE_INT_REG1 0x68
-#define READ_INT_REG1 0x69
-
-#define READ_INT_REG2 0x6A
-#define WRITE_INT_REG2 0x6B
-
-#define READ_CLOCK_ADJUST_REG 0x6C
-#define WRITE_CLOCK_ADJUST_REG 0x6D
-// clock-adjustment register
-
-#define READ_FREE_REG 0x6E
-#define WRITE_FREE_REG 0x6F
-
-
-void rtcReset(void);
-void rtcTransaction(uint8 * command, uint32 commandLength, uint8 * result, uint32 resultLength);
-
-void rtcGetTime(uint8 * time);
-void rtcSetTime(uint8 * time);
-
-void rtcGetTimeAndDate(uint8 * time);
-void rtcSetTimeAndDate(uint8 * time);
-
-void rtcGetData(uint8 * data, uint32 size);
-
-void BCDToInteger(uint8 * data, uint32 length);
-void integerToBCD(uint8 * data, uint32 length);
-
-void initClockIRQ(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h
deleted file mode 100644
index 9814ecaec0..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/serial.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*---------------------------------------------------------------------------------
- ARM7 serial control
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-
-#ifndef SERIAL_ARM7_INCLUDE
-#define SERIAL_ARM7_INCLUDE
-
-#ifndef ARM7
-#error Serial header is for ARM7 only
-#endif
-
-
-#include <nds/bios.h>
-
-
-// 'Networking'
-#define REG_RCNT (*(vuint16*)0x04000134)
-#define REG_KEYXY (*(vuint16*)0x04000136)
-#define RTC_CR (*(vuint16*)0x04000138)
-#define RTC_CR8 (*( vuint8*)0x04000138)
-
-#define REG_SIOCNT (*(vuint16*)0x04000128)
-
-#define SIO_DATA8 (*(vuint8*)0x0400012A)
-#define SIO_DATA32 (*(vuint32*)0x04000120)
-
-
-// Fixme: Does the hardware still support 16 bit comms mode?
-// BIOS makes use of 32 bit mode, so some regs still exist
-#define SIO_MULTI_0 (*(vuint16*)0x04000120)
-#define SIO_MULTI_1 (*(vuint16*)0x04000122)
-#define SIO_MULTI_2 (*(vuint16*)0x04000124)
-#define SIO_MULTI_3 (*(vuint16*)0x04000126)
-#define SIO_MULTI_SEND (*(vuint16*)0x0400012A)
-
-
-// SPI chain registers
-#define REG_SPICNT (*(vuint16*)0x040001C0)
-#define REG_SPIDATA (*(vuint16*)0x040001C2)
-
-#define SPI_ENABLE BIT(15)
-#define SPI_IRQ BIT(14)
-#define SPI_BUSY BIT(7)
-
-// Pick the SPI clock speed
-#define SPI_BAUD_4MHZ 0
-#define SPI_BAUD_2MHZ 1
-#define SPI_BAUD_1MHZ 2
-#define SPI_BAUD_512KHZ 3
-
-// meh
-#define SPI_BAUD_4MHz 0
-#define SPI_BAUD_2MHz 1
-#define SPI_BAUD_1MHz 2
-#define SPI_BAUD_512KHz 3
-
-// Pick the SPI transfer length
-#define SPI_BYTE_MODE (0<<10)
-#define SPI_HWORD_MODE (1<<10)
-
-// Pick the SPI device
-#define SPI_DEVICE_POWER (0 << 8)
-#define SPI_DEVICE_FIRMWARE (1 << 8)
-#define SPI_DEVICE_NVRAM (1 << 8)
-#define SPI_DEVICE_TOUCH (2 << 8)
-#define SPI_DEVICE_MICROPHONE (2 << 8)
-
-// When used, the /CS line will stay low after the transfer ends
-// i.e. when we're part of a continuous transfer
-#define SPI_CONTINUOUS BIT(11)
-
-// Fixme: does this stuff really belong in serial.h?
-
-// Power management registers
-#define PM_CONTROL_REG 0
-#define PM_BATTERY_REG 1
-#define PM_AMPLIFIER_REG 2
-#define PM_READ_REGISTER (1<<7)
-
-// PM control register bits - power control
-#define PM_SOUND_AMP BIT(0) // Power the sound hardware (needed to hear stuff in GBA mode too)
-#define PM_SOUND_MUTE BIT(1) // Mute the main speakers, headphone output will still work.
-#define PM_BACKLIGHT_BOTTOM BIT(2) // Enable the top backlight if set
-#define PM_BACKLIGHT_TOP BIT(3) // Enable the bottom backlight if set
-#define PM_SYSTEM_PWR BIT(6) // Turn the power *off* if set
-#define PM_POWER_DOWN BIT(6) // Same thing, I like this name better tho
-
-// PM control register bits - LED control
-#define PM_LED_CONTROL(m) ((m)<<4) // ?
-
-
-#define PM_LED_ON (0<<4) // Steady on
-#define PM_LED_SLEEP (1<<4) // Blinking, mostly off
-#define PM_LED_BLINK (3<<4) // Blinking, mostly on
-
-
-#define PM_AMP_OFFSET 2
-#define PM_AMP_ON 1
-#define PM_AMP_OFF 0
-
-// Fixme: does this stuff really belong in serial.h?
-
-// Firmware commands
-#define FIRMWARE_WREN 0x06
-#define FIRMWARE_WRDI 0x04
-#define FIRMWARE_RDID 0x9F
-#define FIRMWARE_RDSR 0x05
-#define FIRMWARE_READ 0x03
-#define FIRMWARE_PW 0x0A
-#define FIRMWARE_PP 0x02
-#define FIRMWARE_FAST 0x0B
-#define FIRMWARE_PE 0xDB
-#define FIRMWARE_SE 0xD8
-#define FIRMWARE_DP 0xB9
-#define FIRMWARE_RDP 0xAB
-
-
-static inline
-void SerialWaitBusy(void) {
- while (REG_SPICNT & SPI_BUSY)
- swiDelay(1);
-}
-
-
-// Warning: These functions use the SPI chain, and are thus 'critical'
-// sections, make sure to disable interrupts during the call if you've
-// got a VBlank IRQ polling the touch screen, etc...
-
-// Read/write a power management register
-int writePowerManagement(int reg, int command);
-
-static inline
-int readPowerManagement(int reg) {
- return writePowerManagement((reg)|PM_READ_REGISTER, 0);
-}
-
-// Read the firmware
-void readFirmware(uint32 address, void * destination, uint32 size);
-
-
-#endif
-
diff --git a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h b/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h
deleted file mode 100644
index 91285d314d..0000000000
--- a/c/src/lib/libbsp/arm/nds/libnds/include/nds/arm7/touch.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*---------------------------------------------------------------------------------
- Microphone control for the ARM7
-
- Copyright (C) 2005
- Michael Noland (joat)
- Jason Rogers (dovoto)
- Dave Murphy (WinterMute)
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any
- damages arising from the use of this software.
-
- Permission is granted to anyone to use this software for any
- purpose, including commercial applications, and to alter it and
- redistribute it freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
- must not claim that you wrote the original software. If you use
- this software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and
- must not be misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
-
----------------------------------------------------------------------------------*/
-#ifndef ARM7_TOUCH_INCLUDE
-#define ARM7_TOUCH_INCLUDE
-//---------------------------------------------------------------------------------
-
-
-#ifndef ARM7
-#error Touch screen is only available on the ARM7
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <nds/arm7/serial.h>
-
-
-#define SCREEN_WIDTH 256
-#define SCREEN_HEIGHT 192
-
-
-#define TSC_MEASURE_TEMP1 0x84
-#define TSC_MEASURE_Y 0x90
-#define TSC_MEASURE_BATTERY 0xA4
-#define TSC_MEASURE_Z1 0xB4
-#define TSC_MEASURE_Z2 0xC4
-#define TSC_MEASURE_X 0xD0
-#define TSC_MEASURE_AUX 0xE4
-#define TSC_MEASURE_TEMP2 0xF4
-
-
-
-touchPosition touchReadXY(void);
-
-uint16 touchRead(uint32 command);
-uint32 touchReadTemperature(int * t1, int * t2);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-//---------------------------------------------------------------------------------
-#endif // ARM7_TOUCH_INCLUDE
-//---------------------------------------------------------------------------------
-