armadeus-commitlog Mailing List for armadeus (Page 149)
Brought to you by:
sszy
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(43) |
Feb
(8) |
Mar
(7) |
Apr
(8) |
May
(14) |
Jun
(6) |
Jul
(4) |
Aug
(17) |
Sep
(18) |
Oct
(19) |
Nov
(52) |
Dec
(30) |
| 2008 |
Jan
(6) |
Feb
(6) |
Mar
(15) |
Apr
(22) |
May
(13) |
Jun
(11) |
Jul
(41) |
Aug
(10) |
Sep
(14) |
Oct
(21) |
Nov
(4) |
Dec
(66) |
| 2009 |
Jan
(67) |
Feb
(57) |
Mar
(90) |
Apr
(54) |
May
(64) |
Jun
(76) |
Jul
(14) |
Aug
(18) |
Sep
(18) |
Oct
(20) |
Nov
(15) |
Dec
(36) |
| 2010 |
Jan
(28) |
Feb
(25) |
Mar
(32) |
Apr
(23) |
May
(22) |
Jun
(62) |
Jul
(36) |
Aug
(16) |
Sep
(12) |
Oct
(20) |
Nov
(44) |
Dec
(25) |
| 2011 |
Jan
(36) |
Feb
(49) |
Mar
(28) |
Apr
(38) |
May
(26) |
Jun
(52) |
Jul
(33) |
Aug
(32) |
Sep
(19) |
Oct
(26) |
Nov
(13) |
Dec
(32) |
| 2012 |
Jan
(38) |
Feb
(34) |
Mar
(91) |
Apr
(35) |
May
(31) |
Jun
(72) |
Jul
(23) |
Aug
(13) |
Sep
(33) |
Oct
(47) |
Nov
(18) |
Dec
(22) |
| 2013 |
Jan
(31) |
Feb
(22) |
Mar
(26) |
Apr
(11) |
May
(38) |
Jun
(15) |
Jul
(37) |
Aug
(68) |
Sep
(34) |
Oct
(11) |
Nov
(26) |
Dec
(31) |
| 2014 |
Jan
(60) |
Feb
(55) |
Mar
(21) |
Apr
(31) |
May
(17) |
Jun
(35) |
Jul
(24) |
Aug
(17) |
Sep
(11) |
Oct
(23) |
Nov
(10) |
Dec
(23) |
| 2015 |
Jan
(15) |
Feb
(34) |
Mar
(46) |
Apr
(23) |
May
(12) |
Jun
(14) |
Jul
(18) |
Aug
(22) |
Sep
(6) |
Oct
(2) |
Nov
(1) |
Dec
(6) |
| 2016 |
Jan
(5) |
Feb
(7) |
Mar
(10) |
Apr
(10) |
May
(17) |
Jun
(6) |
Jul
(4) |
Aug
(6) |
Sep
(22) |
Oct
(8) |
Nov
(9) |
Dec
(5) |
| 2017 |
Jan
(11) |
Feb
(12) |
Mar
(27) |
Apr
(9) |
May
(1) |
Jun
(5) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
(10) |
Nov
(4) |
Dec
(6) |
| 2018 |
Jan
(6) |
Feb
(13) |
Mar
(9) |
Apr
(7) |
May
(10) |
Jun
(9) |
Jul
(21) |
Aug
(13) |
Sep
(10) |
Oct
(4) |
Nov
(6) |
Dec
(1) |
| 2019 |
Jan
(6) |
Feb
(2) |
Mar
(5) |
Apr
(6) |
May
(19) |
Jun
(14) |
Jul
(18) |
Aug
(3) |
Sep
(5) |
Oct
(7) |
Nov
(8) |
Dec
(4) |
| 2020 |
Jan
(10) |
Feb
(3) |
Mar
(9) |
Apr
(7) |
May
(2) |
Jun
(18) |
Jul
(3) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
| 2021 |
Jan
(9) |
Feb
(6) |
Mar
(4) |
Apr
(11) |
May
(7) |
Jun
(5) |
Jul
(2) |
Aug
(4) |
Sep
(10) |
Oct
(9) |
Nov
(5) |
Dec
|
| 2022 |
Jan
(2) |
Feb
(12) |
Mar
(3) |
Apr
(5) |
May
(1) |
Jun
(3) |
Jul
(2) |
Aug
(1) |
Sep
(4) |
Oct
(4) |
Nov
(1) |
Dec
(3) |
| 2023 |
Jan
(5) |
Feb
(3) |
Mar
(3) |
Apr
(2) |
May
(1) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(4) |
| 2024 |
Jan
(2) |
Feb
(3) |
Mar
(8) |
Apr
(4) |
May
(1) |
Jun
(13) |
Jul
(7) |
Aug
(1) |
Sep
(6) |
Oct
(5) |
Nov
(11) |
Dec
(7) |
| 2025 |
Jan
(3) |
Feb
(1) |
Mar
(6) |
Apr
(4) |
May
(4) |
Jun
(1) |
Jul
(1) |
Aug
(7) |
Sep
(4) |
Oct
(4) |
Nov
(4) |
Dec
(1) |
| 2026 |
Jan
(3) |
Feb
(7) |
Mar
(3) |
Apr
(1) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <th...@us...> - 2007-08-30 13:59:50
|
Revision: 629
http://armadeus.svn.sourceforge.net/armadeus/?rev=629&view=rev
Author: thom25
Date: 2007-08-30 06:59:53 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
fix bug 1768755
PS2 IP only compatible with old APD board
Modified Paths:
--------------
trunk/firmware/PS2/PS2.ise
trunk/firmware/PS2/PS2_top.vhd
trunk/firmware/PS2/ps2_top.bit
Modified: trunk/firmware/PS2/PS2.ise
===================================================================
(Binary files differ)
Modified: trunk/firmware/PS2/PS2_top.vhd
===================================================================
--- trunk/firmware/PS2/PS2_top.vhd 2007-08-30 13:35:41 UTC (rev 628)
+++ trunk/firmware/PS2/PS2_top.vhd 2007-08-30 13:59:53 UTC (rev 629)
@@ -105,9 +105,9 @@
elsif ClkxCI'event and ClkxCI = '1' then -- rising clock edge
if CSxBI = '0' and WRxBI = '0' then
case AddrxDI is
- when "0000000000010" =>
+ when "0000000000100" =>
reg1 <= DataxD(7 downto 0);
- when "0000000000011" =>
+ when "0000000000110" =>
reg2 <= DataxD(7 downto 0);
when others => null;
end case;
@@ -158,12 +158,12 @@
if readAccessPulse = '0' then
readAccessPulseFiFo <= '0';
end if;
- when "0000000000010" =>
+ when "0000000000100" =>
DataOutRAMxD <= "00000000" & reg1;
- when "0000000000011" =>
+ when "0000000000110" =>
DataOutRAMxD <= "00000000" & reg2;
- when "0000000000100" =>
+ when "0000000001000" =>
DataOutRAMxD <= "0001001000110100";
when others =>
DataOutRAMxD <= (others => '0');
Modified: trunk/firmware/PS2/ps2_top.bit
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-30 13:35:48
|
Revision: 628
http://armadeus.svn.sourceforge.net/armadeus/?rev=628&view=rev
Author: thom25
Date: 2007-08-30 06:35:41 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
fix minor bug
Modified Paths:
--------------
trunk/target/packages/ch7024ctrl/ch7024.c
Modified: trunk/target/packages/ch7024ctrl/ch7024.c
===================================================================
--- trunk/target/packages/ch7024ctrl/ch7024.c 2007-08-30 13:33:17 UTC (rev 627)
+++ trunk/target/packages/ch7024ctrl/ch7024.c 2007-08-30 13:35:41 UTC (rev 628)
@@ -226,7 +226,7 @@
// check CH7024 presence
if( !read_byte( fd, DEVICE_ID_CMD, buf ) ){
if( buf[0] != CH7024_ID ){
- printf("CH7024 found. Exit\n");
+ printf("CH7024 not found. Exit\n");
exit(1);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-30 13:33:31
|
Revision: 627
http://armadeus.svn.sourceforge.net/armadeus/?rev=627&view=rev
Author: thom25
Date: 2007-08-30 06:33:17 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
add configuration file
Added Paths:
-----------
trunk/target/packages/ch7024ctrl/ch424x283.conf
trunk/target/packages/ch7024ctrl/ch424x283_readme.txt
Added: trunk/target/packages/ch7024ctrl/ch424x283.conf
===================================================================
--- trunk/target/packages/ch7024ctrl/ch424x283.conf (rev 0)
+++ trunk/target/packages/ch7024ctrl/ch424x283.conf 2007-08-30 13:33:17 UTC (rev 627)
@@ -0,0 +1,15 @@
+00:45 01:00 02:00 03:03
+04:00 05:20 06:20 07:49
+08:80 09:05 0A:63 0B:08
+0C:00 0D:03 0E:00 0F:00
+10:01 11:09 12:40 13:A8
+14:00 15:27 16:00 17:04
+18:F0 19:1B 1A:00 1B:00
+1C:90 1D:8C 1E:05 1F:A0
+20:00 21:30 22:00 23:80
+24:00 25:00 26:00 27:00
+28:0E 29:96 2A:00 2B:10
+2C:7A 2D:C0 2E:38 2F:00
+30:09 31:14 32:00 33:00
+34:01 35:1C 36:64 37:40
+62:32 63:C2 7E:00
\ No newline at end of file
Added: trunk/target/packages/ch7024ctrl/ch424x283_readme.txt
===================================================================
--- trunk/target/packages/ch7024ctrl/ch424x283_readme.txt (rev 0)
+++ trunk/target/packages/ch7024ctrl/ch424x283_readme.txt 2007-08-30 13:33:17 UTC (rev 627)
@@ -0,0 +1,4 @@
+iMXL LCD controller parameters:
+LPCR: 0XF8C80087
+HCR: 0X78000144
+VCR: 0X0C001414
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-29 14:54:58
|
Revision: 626
http://armadeus.svn.sourceforge.net/armadeus/?rev=626&view=rev
Author: thom25
Date: 2007-08-29 07:54:57 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
fix bug 1784183: uboot recover does not erase the env partition
Modified Paths:
--------------
trunk/software/uboot_recover/bootloader.py
Modified: trunk/software/uboot_recover/bootloader.py
===================================================================
--- trunk/software/uboot_recover/bootloader.py 2007-08-26 16:47:58 UTC (rev 625)
+++ trunk/software/uboot_recover/bootloader.py 2007-08-29 14:54:57 UTC (rev 626)
@@ -151,8 +151,18 @@
#self.Flashbin(address, '%x' % os.stat(a)[6],"08001000")
def Flashbin( self, address, size, fileRamPosition ):
- # initialize flash interface by programming the imx bus controller
- self.put("00220004", "00000D01", 'l')
+ # erase the whole flash
+ self.put("00220004", "00000D01", "l") # Configure CS0 as 16bits wide bus
+ self.put("10000000", "0060", "w") # Clear block lock bit
+ self.put("10000000", "00D0", "w") # Clear block lock bit
+ self.eraseFlashBlock("10000000")
+ self.eraseFlashBlock("10020000")
+ self.eraseFlashBlock("10040000")
+ self.eraseFlashBlock("10080000")
+ self.eraseFlashBlock("10100000")
+ self.eraseFlashBlock("10200000")
+ self.eraseFlashBlock("10400000")
+
# load FlashBurner program
self.loadbin( "flashprogrammer.bin","08000400")
# store file size at address 0x08000000 for FlashBurner program
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-27 18:35:41
|
Revision: 625
http://armadeus.svn.sourceforge.net/armadeus/?rev=625&view=rev
Author: thom25
Date: 2007-08-26 09:47:58 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
add several comments. Used as tutorial for I2C access
Modified Paths:
--------------
trunk/target/packages/ch7024ctrl/ch7024.c
Modified: trunk/target/packages/ch7024ctrl/ch7024.c
===================================================================
--- trunk/target/packages/ch7024ctrl/ch7024.c 2007-08-26 14:27:43 UTC (rev 624)
+++ trunk/target/packages/ch7024ctrl/ch7024.c 2007-08-26 16:47:58 UTC (rev 625)
@@ -17,7 +17,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** ch7024: manage the Svideo output controller CH7024
+** ch7024: manage the Svideo controller CH7024
**
** author: th...@us...
*/
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
-#include <linux/i2c.h> // seems to make trouble during compiling ....
+#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
@@ -54,24 +54,31 @@
printf ("other: menu\n");
}
-/* Read a byte on the I2C bus
+/* Read a byte on the I2C bus
+ This is done by writing the register address
+ we want to access and then by reading this register
@param fd: file descriptor of the device
- @param reg: registre to access
+ @param reg: register to access
@param buf: buffer used to store the result
@return : -1 in case of error otherwise 0
*/
int read_byte( int fd, unsigned char reg, unsigned char *buf )
-{
+{
+ // create an I2C write message (only one byte: the address)
struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, 1, buf };
+ // create a I2C IOCTL request
struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
buf[0] = reg; // select reg to read
+
+ // write the desired register address
if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
printf("Write error\n");
return -1;
}
msg.flags = I2C_M_RD; // read
-
+
+ // read the result and write it in buf[0]
if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
printf("Read error\n");
return -1;
@@ -81,14 +88,18 @@
/* Write a byte on the I2C bus
@param fd: file descriptor of the device
- @param reg: registre to access
+ @param reg: register to access
@param value: value to write
@return : -1 in case of error otherwise 0
*/
int write_byte(int fd, unsigned char reg, unsigned char value)
{
- unsigned char buf[2] = {reg,value};
- struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, sizeof(buf), buf };
+ unsigned char buf[2] = {reg,value}; // initialise a data buffer with
+ // address and data
+
+ // create an I2C write message
+ struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, sizeof(buf), buf };
+ // create a I2C IOCTL request
struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
#ifdef DEBUG_CH7024
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-27 14:36:26
|
Revision: 624
http://armadeus.svn.sourceforge.net/armadeus/?rev=624&view=rev
Author: thom25
Date: 2007-08-26 07:27:43 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
add SRAM test VHDL code for the Devfull
Added Paths:
-----------
trunk/firmware/sram_test/
trunk/firmware/sram_test/sram_test.ise
trunk/firmware/sram_test/sram_test.ucf
trunk/firmware/sram_test/sram_test.vhd
Added: trunk/firmware/sram_test/sram_test.ise
===================================================================
(Binary files differ)
Property changes on: trunk/firmware/sram_test/sram_test.ise
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/firmware/sram_test/sram_test.ucf
===================================================================
--- trunk/firmware/sram_test/sram_test.ucf (rev 0)
+++ trunk/firmware/sram_test/sram_test.ucf 2007-08-26 14:27:43 UTC (rev 624)
@@ -0,0 +1,102 @@
+#NET "ClkxCI" TNM_NET = "ClkxCI";
+#TIMESPEC "TS_ClkxCI" = PERIOD "ClkxCI" 10 ns HIGH 50 %;
+
+#PACE: Start of Constraints generated by PACE
+
+#PACE: Start of PACE I/O Pin Assignments
+
+# -------------------- Generic -----------------------
+
+NET "AddrxDI<0>" LOC = "P21" ;
+NET "AddrxDI<1>" LOC = "P23" ;
+NET "AddrxDI<2>" LOC = "P24" ;
+NET "AddrxDI<3>" LOC = "P25" ;
+NET "AddrxDI<4>" LOC = "P26" ;
+NET "AddrxDI<5>" LOC = "P27" ;
+NET "AddrxDI<6>" LOC = "P28" ;
+NET "AddrxDI<7>" LOC = "P30" ;
+NET "AddrxDI<8>" LOC = "P31" ;
+NET "AddrxDI<9>" LOC = "P32" ;
+NET "AddrxDI<10>" LOC = "P33" ;
+NET "AddrxDI<11>" LOC = "P35" ;
+NET "AddrxDI<12>" LOC = "P36" ;
+
+NET "ClkxCI" LOC = "P55" ;
+NET "CSxBI" LOC = "P59" ;
+NET "DataxD<0>" LOC = "P1" ;
+NET "DataxD<10>" LOC = "P13" ;
+NET "DataxD<11>" LOC = "P14" ;
+NET "DataxD<12>" LOC = "P15" ;
+NET "DataxD<13>" LOC = "P17" ;
+NET "DataxD<14>" LOC = "P18" ;
+NET "DataxD<15>" LOC = "P20" ;
+NET "DataxD<1>" LOC = "P2" ;
+NET "DataxD<2>" LOC = "P4" ;
+NET "DataxD<3>" LOC = "P5" ;
+NET "DataxD<4>" LOC = "P6" ;
+NET "DataxD<5>" LOC = "P7" ;
+NET "DataxD<6>" LOC = "P8" ;
+NET "DataxD<7>" LOC = "P10" ;
+NET "DataxD<8>" LOC = "P11" ;
+NET "DataxD<9>" LOC = "P12" ;
+NET "WRxBI" LOC = "P60" ;
+NET "RDxBI" LOC = "P63" ;
+
+# -------------------Test Specific FOR A CY7C1021 !!!!!!---------------------------
+
+NET "SRAM_Addr<0>" LOC = "P74" ;
+NET "SRAM_Addr<1>" LOC = "P77" ;
+NET "SRAM_Addr<2>" LOC = "P79" ;
+NET "SRAM_Addr<3>" LOC = "P82" ;
+NET "SRAM_Addr<4>" LOC = "P84" ;
+NET "SRAM_Addr<5>" LOC = "P73" ;
+NET "SRAM_Addr<6>" LOC = "P53" ;
+NET "SRAM_Addr<7>" LOC = "P51" ;
+NET "SRAM_Addr<8>" LOC = "P99" ;
+NET "SRAM_Addr<9>" LOC = "P100" ;
+NET "SRAM_Addr<10>" LOC = "P102" ;
+NET "SRAM_Addr<11>" LOC = "P103" ;
+NET "SRAM_Addr<12>" LOC = "P86" ;
+NET "SRAM_Addr<13>" LOC = "P87" ;
+NET "SRAM_Addr<14>" LOC = "P108" ;
+NET "SRAM_Addr<15>" LOC = "P107" ;
+
+# different mapping for a CY7C1011
+#NET "SRAM_Addr<12>" LOC = "P104" ;
+#NET "SRAM_Addr<13>" LOC = "P86" ;
+#NET "SRAM_Addr<14>" LOC = "P87" ;
+#NET "SRAM_Addr<15>" LOC = "P108" ;
+#NET "SRAM_Addr<16>" LOC = "P107" ;
+#NET "SRAM_Addr<17>" LOC = "P85" ;
+
+NET "SRAM_Data<0>" LOC = "P52" ;
+NET "SRAM_Data<1>" LOC = "P50" ;
+NET "SRAM_Data<2>" LOC = "P46" ;
+NET "SRAM_Data<3>" LOC = "P41" ;
+NET "SRAM_Data<4>" LOC = "P83" ;
+NET "SRAM_Data<5>" LOC = "P80" ;
+NET "SRAM_Data<6>" LOC = "P78" ;
+NET "SRAM_Data<7>" LOC = "P76" ;
+NET "SRAM_Data<8>" LOC = "P98" ;
+NET "SRAM_Data<9>" LOC = "P97" ;
+NET "SRAM_Data<10>" LOC = "P96" ;
+NET "SRAM_Data<11>" LOC = "P95" ;
+NET "SRAM_Data<12>" LOC = "P93" ;
+NET "SRAM_Data<13>" LOC = "P92" ;
+NET "SRAM_Data<14>" LOC = "P90" ;
+NET "SRAM_Data<15>" LOC = "P89" ;
+
+NET "SRAM_WEn" LOC = "P105" ;
+NET "SRAM_OEn" LOC = "P47" ;
+NET "SRAM_CEn" LOC = "P56" ;
+NET "SRAM_BLEn" LOC = "P40" ;
+NET "SRAM_BHEn" LOC = "P44" ;
+
+#NET "DEBUG" LOC = "P116";
+
+
+#PACE: Start of PACE Area Constraints
+
+#PACE: Start of PACE Prohibit Constraints
+
+#PACE: End of Constraints generated by PACE
\ No newline at end of file
Added: trunk/firmware/sram_test/sram_test.vhd
===================================================================
--- trunk/firmware/sram_test/sram_test.vhd (rev 0)
+++ trunk/firmware/sram_test/sram_test.vhd 2007-08-26 14:27:43 UTC (rev 624)
@@ -0,0 +1,141 @@
+--------------------------------------------------------------------------------
+-- Company: Armadeus Systems
+-- Engineer: NC
+--
+-- Create Date: 23:04:42 08/26/07
+-- Design Name: DEVFULL SRAM TEST
+-- Module Name: SRAM_test - Behavioral
+-- Project Name:
+-- Target Device:
+-- Tool versions:
+-- Description: Used to access the DevFull SRAM (CY7C1021) from UBOOT
+--
+-- Dependencies:
+--
+-- Revision:
+-- Revision 0.01 - File Created
+-- Additional Comments:
+--
+--------------------------------------------------------------------------------
+library IEEE;
+use IEEE.STD_LOGIC_1164.all;
+--use IEEE.STD_LOGIC_ARITH.all;
+--use IEEE.STD_LOGIC_UNSIGNED.all;
+--library UNISIM;
+--use UNISIM.VComponents.all;
+--library XilinxCoreLib;
+--use XilinxCoreLib.all;
+
+
+entity sram_test is -- this is the top
+ port ( DataxD : inout std_logic_vector(15 downto 0);
+ AddrxDI : in std_logic_vector(12 downto 0);
+ WRxBI : in std_logic;
+ RDxBI : in std_logic;
+
+ ClkxCI : in std_logic; --imx bus clock
+ CSxBI : in std_logic; -- fpga CS
+
+ SRAM_Addr : out std_logic_vector(15 downto 0); -- CY7C1021
+ SRAM_Data : inout std_logic_vector(15 downto 0);
+ SRAM_WEn : out std_logic;
+ SRAM_OEn : out std_logic;
+ SRAM_CEn : out std_logic;
+ SRAM_BLEn : out std_logic;
+ SRAM_BHEn : out std_logic
+ );
+end sram_test;
+
+architecture hierarchical of sram_test is
+
+ type readAccessType is ('0','1','2');
+ subtype reg is std_logic_vector (12 downto 0);
+
+ constant SRAM_READ : readAccessType := '0';
+ constant INTERNAL_READ : readAccessType := '1';
+ constant OTHER_READ : readAccessType := '2';
+ constant DATA_REGISTER : reg := b"0000000000010";
+ constant ADDRESS_REGISTER: reg := b"0000000000000";
+
+ signal resetn : std_logic;
+ signal DataxD_out : std_logic_vector(15 downto 0);
+ signal regSRAM_Data_out : std_logic_vector(15 downto 0);
+ signal SRAM_Addr_out : std_logic_vector(15 downto 0);
+ signal regSRAM_WEn_out : std_logic;
+ signal regSRAM_OEn_out : std_logic;
+ signal readAccess : readAccessType;
+
+begin
+
+ resetn <= '1';
+
+ -----------------------------------------------------------------------------
+ -- Process
+ -- purpose: Register Write from businterface
+ -----------------------------------------------------------------------------
+ TestRegister_write : process (CSxBI, ClkxCI, WRxBI, AddrxDI, DataxD )
+ begin -- process TestRegister_write
+ if resetn = '0' then -- asynchronous reset (active low)
+ regSRAM_Data_out <= (others => 'Z');
+ elsif ClkxCI'event and ClkxCI = '1' then -- rising clock edge
+ if CSxBI = '0' and WRxBI = '0' then
+ case AddrxDI is
+ when ADDRESS_REGISTER =>
+ SRAM_Addr_out <= DataxD(15 downto 0);
+ regSRAM_WEn_out <= '1';
+ when DATA_REGISTER =>
+ regSRAM_Data_out <= DataxD(15 downto 0);
+ regSRAM_WEn_out <= '0';
+ when others =>
+ regSRAM_Data_out <= (others => '0');
+ regSRAM_WEn_out <= '1';
+ end case;
+ else
+ regSRAM_Data_out <= (others => 'Z');
+ regSRAM_WEn_out <= '1';
+ end if;
+ end if;
+ end process TestRegister_write;
+
+
+SRAM_read_process : process (ClkxCI, readAccess, SRAM_Data )
+begin -- process TestRegister_write
+ if ClkxCI'event and ClkxCI = '1' then
+ if readAccess = SRAM_READ then
+ DataxD_out <= SRAM_Data(15 downto 0);
+ elsif readAccess = INTERNAL_READ then
+ DataxD_out <= (others => '0');
+ else -- other
+ DataxD_out <= (others => 'Z');
+ end if;
+ end if;
+end process SRAM_read_process;
+
+ TestRegister_read : process (CSxBI, RDxBI, AddrxDI, DataxD, ClkxCI )
+ begin -- process TestRegister_write
+
+ if CSxBI = '0' and RDxBI = '0' then
+ case AddrxDI is
+ when DATA_REGISTER => -- data register
+ regSRAM_OEn_out <= '0';
+ readAccess <= SRAM_READ; -- SRAM read
+ when others =>
+ readAccess <= INTERNAL_READ; -- INTERNAL read
+ regSRAM_OEn_out <= '1';
+ end case;
+ else
+ readAccess <= OTHER_READ;
+ regSRAM_OEn_out <= '1';
+ end if;
+ end process TestRegister_read;
+
+
+ DataxD <= DataxD_out;
+ SRAM_Addr <= SRAM_Addr_out(15 downto 0);
+ SRAM_Data <= regSRAM_Data_out;
+ SRAM_CEn <= CSxBI;
+ SRAM_OEn <= regSRAM_OEn_out;
+ SRAM_WEn <= regSRAM_WEn_out;
+ SRAM_BLEn <= '0';
+ SRAM_BHEn <= '0';
+ end hierarchical;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-08-17 17:21:50
|
Revision: 623
http://armadeus.svn.sourceforge.net/armadeus/?rev=623&view=rev
Author: thom25
Date: 2007-08-17 10:21:47 -0700 (Fri, 17 Aug 2007)
Log Message:
-----------
add CH7024 tool
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/Config.in
Added Paths:
-----------
trunk/target/packages/ch7024ctrl/
trunk/target/packages/ch7024ctrl/Makefile
trunk/target/packages/ch7024ctrl/ch7024.c
trunk/target/packages/ch7024ctrl/ch7024.h
Modified: trunk/buildroot/target/device/armadeus/Config.in
===================================================================
--- trunk/buildroot/target/device/armadeus/Config.in 2007-08-09 22:43:03 UTC (rev 622)
+++ trunk/buildroot/target/device/armadeus/Config.in 2007-08-17 17:21:47 UTC (rev 623)
@@ -61,6 +61,13 @@
source package/max5821ctrl/Config.in
comment "---"
+config BR2_ARMADEUS_PACKAGE
+ bool "armadeus packages"
+ default n
+ depends BR2_TARGET_ARMADEUS
+ source package/ch7024ctrl/Config.in
+ comment "---"
+
config BR2_PACKAGE_LINUX
bool "linux"
default n
Added: trunk/target/packages/ch7024ctrl/Makefile
===================================================================
--- trunk/target/packages/ch7024ctrl/Makefile (rev 0)
+++ trunk/target/packages/ch7024ctrl/Makefile 2007-08-17 17:21:47 UTC (rev 623)
@@ -0,0 +1,59 @@
+#
+# Makefile for the Armadeus SVIDEO controler CH7024
+#
+
+CFLAGS = -Wall -O
+
+INCLUDES =
+
+PWD := $(shell pwd)
+
+#HEADERS =
+
+SOURCES = ch7024.c
+OBJECTS = ch7024.o
+
+TARGET = ch7024
+
+
+####### Implicit rules
+
+.SUFFIXES: .cpp .cxx .cc .C .c
+
+.cpp.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+.cxx.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+.cc.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+.C.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+
+####### Build rules
+
+
+$(TARGET): $(OBJECTS) Makefile $(HEADERS)
+ @echo
+ @echo "Building I2C dac test programm..."
+ $(CC) $(OBJECTS) $(CFLAGS) $(INCLUDES) -o $(TARGET)
+
+
+all: $(TARGET)
+
+clean:
+ -rm -f $(TARGET)
+ -rm -f *.o *~ core
+
+ch7024.o: ch7024.c ch7024.h Makefile
+ @echo
+ $(CC) -c $(CFLAGS) $(INCLUDES) ch7024.c
+
+
+
Added: trunk/target/packages/ch7024ctrl/ch7024.c
===================================================================
--- trunk/target/packages/ch7024ctrl/ch7024.c (rev 0)
+++ trunk/target/packages/ch7024ctrl/ch7024.c 2007-08-17 17:21:47 UTC (rev 623)
@@ -0,0 +1,264 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (C) year The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** ch7024: manage the Svideo output controller CH7024
+**
+** author: th...@us...
+*/
+
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <linux/i2c.h> // seems to make trouble during compiling ....
+#include <linux/i2c-dev.h>
+
+#include <sys/ioctl.h>
+#include "ch7024.h"
+//#define DEBUG_CH7024 1
+
+#define VERSION 0.1f
+#define CONF_FILE "ch7024.conf"
+#define MAX_DUMP_LINE 100
+/****************************************************************************************************************************/
+
+/* MENU */
+void usage()
+{
+ printf ("\nCH7024 utility ver %0.1f. Armadeus\n", VERSION);
+ printf ("q: quit\n");
+ printf ("m: modify\n");
+ printf ("d: dump all\n");
+ printf ("s: save\n");
+ printf ("l: load\n");
+ printf ("other: menu\n");
+}
+
+/* Read a byte on the I2C bus
+ @param fd: file descriptor of the device
+ @param reg: registre to access
+ @param buf: buffer used to store the result
+ @return : -1 in case of error otherwise 0
+ */
+int read_byte( int fd, unsigned char reg, unsigned char *buf )
+{
+ struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, 1, buf };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+
+ buf[0] = reg; // select reg to read
+ if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
+ printf("Write error\n");
+ return -1;
+ }
+ msg.flags = I2C_M_RD; // read
+
+ if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
+ printf("Read error\n");
+ return -1;
+ }
+ return 0;
+}
+
+/* Write a byte on the I2C bus
+ @param fd: file descriptor of the device
+ @param reg: registre to access
+ @param value: value to write
+ @return : -1 in case of error otherwise 0
+ */
+int write_byte(int fd, unsigned char reg, unsigned char value)
+{
+ unsigned char buf[2] = {reg,value};
+ struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, sizeof(buf), buf };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+
+#ifdef DEBUG_CH7024
+ printf("write ref %02X value %02X\n",reg, value);
+#endif
+ if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
+ printf("Write error\n");
+ return -1;
+ }
+ return 0;
+}
+
+/* dump the register values on the screen if destFile is NULL or in a file
+ @param string: string to dump
+ @param destFile: file in which to write
+ */
+ void dump2Output(char* string, FILE* destFile)
+{
+ if( destFile == NULL )
+ printf("%s", string);
+ else
+ fprintf(destFile,"%s", string);
+}
+
+/* dump the register values on the screen if destFile is NULL or in a file
+ @param fd: file descriptor of the CH7024
+ @param destFile: file in which to write if used otherwise ""
+ */
+void dump(int fd, FILE* destFile)
+{
+ int i,j, address;
+ unsigned char buf[2];
+ char dumpString[MAX_DUMP_LINE];
+
+ if( destFile == NULL )
+ printf("Ad:Va\tRe:Va\tRe:Va\tRe:Va\n");
+ for( i = 0; i<14; i++ ){
+ for( j = 0; j<4; j++ ){
+ address = i*4+j;
+ if( !read_byte( fd, address, buf ) ){
+ sprintf( dumpString, "%02X:%02X\t", address, buf[0] );
+ dump2Output( dumpString, destFile );
+ }
+ }
+ dump2Output( "\n", destFile );
+ }
+ if( !read_byte( fd, DAC_TRIMMING_CMD, buf ) ){
+ sprintf( dumpString, "%02X:%02X\t", DAC_TRIMMING_CMD, buf[0] );
+ dump2Output( dumpString, destFile );
+ }
+ if( !read_byte( fd, DATA_IO_CMD, buf ) ){
+ sprintf( dumpString, "%02X:%02X\t", DATA_IO_CMD, buf[0] );
+ dump2Output( dumpString, destFile );
+ }
+ if( !read_byte( fd, ATTACHED_DISPLAY, buf ) ){
+ sprintf( dumpString, "%02X:%02X\n", ATTACHED_DISPLAY, buf[0] );
+ dump2Output( dumpString, destFile );
+ }
+}
+
+/* load the CH7024 registers with the values contained in the given file
+ @param fd: file descriptor of the CH7024
+ @param fileName: file containing the values. If "" then the name has to be entered
+ */
+void load( int fd, char* fileName )
+{
+ char line[MAX_DUMP_LINE];
+ FILE *fd_conf = NULL;
+ int addr1, addr2, addr3, addr4;
+ int val1, val2, val3, val4;
+ int nb;
+
+ if( strlen(fileName) == 0 ){
+ printf("Enter file name: ");
+ gets(fileName);
+ }
+ if ((fd_conf = fopen(fileName,"r")) < 0){
+ perror("Open error: ");
+ exit (1);
+ }
+ while(fgets(line, MAX_DUMP_LINE, fd_conf) != NULL){
+ nb = sscanf(line,"%2X%*c%2X%2X%*c%2X%2X%*c%2X%2X%*c%2X",
+ &addr1,&val1,&addr2,&val2,&addr3,&val3,&addr4,&val4 );
+ if(nb>=2)
+ write_byte (fd, addr1, val1);
+ if(nb>=4)
+ write_byte (fd, addr2, val2);
+ if(nb>=6)
+ write_byte (fd, addr3, val3);
+ if(nb>=8)
+ write_byte (fd, addr4, val4);
+ }
+ if(fd_conf != NULL)
+ fclose(fd_conf);
+}
+
+
+int main(int argc, char *argv[])
+{
+ int fd; // CH7024 file descriptor
+ FILE *fd_conf = NULL; // config file
+ char string[10]; // user input string
+ unsigned char buf[2]; // buf to store I2C command/data
+ int regAddr;
+ int regValue;
+
+ if ( argc >2 ){ // too many args
+ usage();
+ exit(1);
+ }
+
+ // open I2C /dev
+ if ((fd = open("/dev/i2c-0",O_RDWR)) < 0){
+ perror("Open error: ");
+ exit (1);
+ }
+
+ // configure I2C_SLAVE
+ if ( ioctl(fd ,/*I2C_SLAVE*/ 0x703, CH7024_I2C_SLAVE_ADDR) < 0){
+ perror("Ioctl error: ");
+ exit (1);
+ }
+
+ // check CH7024 presence
+ if( !read_byte( fd, DEVICE_ID_CMD, buf ) ){
+ if( buf[0] != CH7024_ID ){
+ printf("CH7024 found. Exit\n");
+ exit(1);
+ }
+ }
+
+ if ( argc == 2 ){ // read data from file
+ load(fd,argv[1]);
+ exit(0);
+ }
+
+ usage();
+ while(1){
+ gets(string);
+ if(string[0] == 'q') // Exit
+ exit(0);
+ else if (string[0] == 'm'){ // Modify registers
+ printf("reg addr (hex without 0x): ");
+ gets(string);
+ sscanf(string,"%2x", ®Addr);
+ printf("reg value (hex without 0x): ");
+ gets(string);
+ sscanf(string,"%2x", ®Value);
+ write_byte (fd, regAddr, regValue);
+ }
+ else if (string[0] == 'd') // Dump to screen
+ dump(fd,fd_conf);
+ else if (string[0] == 's'){ // Save to file
+ if ((fd_conf = fopen(CONF_FILE,"w")) < 0){
+ perror("Open error: ");
+ exit (1);
+ }
+ dump(fd,fd_conf);
+ if(fd_conf != NULL)
+ fclose(fd_conf);
+ }
+ else if (string[0] == 'l'){ // load from file
+ load(fd,"");
+ }
+ else
+ usage();
+ };
+
+ if(fd >= 0)
+ close(fd);
+
+ exit (0);
+}
Added: trunk/target/packages/ch7024ctrl/ch7024.h
===================================================================
--- trunk/target/packages/ch7024ctrl/ch7024.h (rev 0)
+++ trunk/target/packages/ch7024ctrl/ch7024.h 2007-08-17 17:21:47 UTC (rev 623)
@@ -0,0 +1,219 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (C) year The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** File : ch7024.h
+**
+** author: th...@us...
+*/
+
+
+// I2C slave Adresses
+
+#define CH7024_I2C_SLAVE_ADDR 0x76
+
+
+// command bytes
+#define DEVICE_ID_CMD 0x00
+#define REVISION_ID_CMD 0x01
+#define PAGE_SELECT_CMD 0X02
+#define RESET_CMD 0x03
+#define POWER_STATE_CMD 0x04
+#define TV_HUE_CMD 0x05
+#define TV_SAT_CMD 0x06
+#define TV_CONTRAST_CMD 0x07
+#define TV_BRIGHTNESS_CMD 0x08
+#define TV_SHARPNESS_CMD 0x09
+#define VIDEO_OUTPUT_FORMAT_CMD 0x0A
+#define CRYSTAL_CMD 0x0B
+#define INPUT_DATA_FORMAT1_CMD 0x0C
+#define INPUT_DATA_FORMAT2_CMD 0x0D
+#define SYNC_CMD 0x0E
+#define TV_FILTER1_CMD 0x0F
+#define TV_FILTER2_CMD 0x10
+#define INPUT_TIMING1_CMD 0x11
+#define INPUT_TIMING2_CMD 0x12
+#define INPUT_TIMING3_CMD 0x13
+#define INPUT_TIMING4_CMD 0x14
+#define INPUT_TIMING5_CMD 0x15
+#define INPUT_TIMING6_CMD 0x16
+#define INPUT_TIMING7_CMD 0x17
+#define INPUT_TIMING8_CMD 0x18
+#define INPUT_TIMING9_CMD 0x19
+#define INPUT_TIMING10_CMD 0x1A
+#define INPUT_TIMING11_CMD 0x1B
+#define BURST_AMPLITUDE_CMD 0x1C
+#define CLOCK_TREE_CMD 0x1D
+#define OUTPUT_TIMING1_CMD 0x1E
+#define OUTPUT_TIMING2_CMD 0x1F
+#define TV_VERTICAL_POS1_CMD 0x20
+#define TV_VERTICAL_POS2_CMD 0x21
+#define TV_HORIZONTAL_POS1_CMD 0x22
+#define TV_HORIZONTAL_POS2_CMD 0x23
+#define PCLK_CLOCK_DIVIDER1_CMD 0x24
+#define PCLK_CLOCK_DIVIDER2_CMD 0x25
+#define PCLK_CLOCK_DIVIDER3_CMD 0x26
+#define PCLK_CLOCK_DIVIDER4_CMD 0x27
+#define CLOCK_DIVIDER_NUM1_CMD 0x28
+#define CLOCK_DIVIDER_NUM2_CMD 0x29
+#define CLOCK_DIVIDER_NUM3_CMD 0x2A
+#define CLOCK_DIVIDER_DEN1_CMD 0x2B
+#define CLOCK_DIVIDER_DEN2_CMD 0x2C
+#define CLOCK_DIVIDER_DEN3_CMD 0x2D
+#define CLOCK_DIVIDER_INT_CMD 0x2E
+#define PLL_RATIO1_CMD 0x2F
+#define PLL_RATIO2_CMD 0x30
+#define PLL_RATIO3_CMD 0x31
+#define FSCI_ADJUSTMENT1_CMD 0x32
+#define FSCI_ADJUSTMENT2_CMD 0x33
+#define SUB_CARRIER_FREQ1_CMD 0x34
+#define SUB_CARRIER_FREQ2_CMD 0x35
+#define SUB_CARRIER_FREQ3_CMD 0x36
+#define SUB_CARRIER_FREQ4_CMD 0x37
+#define DAC_TRIMMING_CMD 0x62
+#define DATA_IO_CMD 0x63
+#define ATTACHED_DISPLAY 0x7E
+#define CBCR_INPUT_SWITCH_CMD 0x10 // second page
+
+
+#define CH7024_ID 0x45
+#define PAGE_SELECT_0 0
+#define PAGE_SELECT_1 1
+#define DAC_OUTPUT_OFF (0<<4)
+#define DAC_OUTPUT_CVBS (1<<4)
+#define DAC_OUTPUT_SVIDEO (2<<4)
+#define OUTPUT_FORMAT__NTSC_M 0
+#define OUTPUT_FORMAT__NTSC_J 1
+#define OUTPUT_FORMAT__NTSC_443 2
+#define OUTPUT_FORMAT__PAL 3
+#define OUTPUT_FORMAT__PAL_M 4
+#define OUTPUT_FORMAT__PAL_N 5
+#define OUTPUT_FORMAT__PAL_NC 6
+#define OUTPUT_FORMAT__PAL_60 7
+
+
+
+
+
+typedef struct
+{
+ unsigned char resetib : 1;
+ unsigned char resetdb : 1;
+ unsigned char spare : 8;
+} reset_reg;
+
+typedef struct
+{
+ unsigned char fdp : 1;
+ unsigned char reserved : 1;
+ unsigned char ppdac : 2;
+ unsigned char spare : 8;
+} powerState_reg;
+
+typedef struct
+{
+ unsigned char vos : 4;
+ unsigned char dacsw : 2;
+ unsigned char svideo : 1;
+ unsigned char tv_bp : 1;
+} videoOutputFormat_reg;
+
+typedef struct
+{
+ unsigned char xtal : 4;
+ unsigned char spare : 3;
+ unsigned char xtalsel : 1;
+} crystal_reg;
+
+typedef struct
+{
+ unsigned char multi : 1;
+ unsigned char spare : 5;
+ unsigned char dcksel : 1;
+ unsigned char ducvbs : 1;
+} inputDataFormat1_reg;
+
+typedef struct
+{
+ unsigned char idf : 3;
+ unsigned char swap : 3;
+ unsigned char reverse : 1;
+ unsigned char high : 1;
+} inputDataFormat2_reg;
+
+typedef struct
+{
+ unsigned char diffen : 1;
+ unsigned char syo : 1;
+ unsigned char vpo : 1;
+ unsigned char hpo : 1;
+ unsigned char flds : 1;
+ unsigned char fldsen : 1;
+ unsigned char des : 1;
+ unsigned char pouten : 1;
+} sync_reg;
+
+typedef struct
+{
+ unsigned char ycv : 2;
+ unsigned char ysv : 2;
+ unsigned char cbw : 1;
+ unsigned char cfbp : 1;
+ unsigned char cfrb : 1;
+ unsigned char xch : 1;
+} tvFiler1_reg;
+
+typedef struct
+{
+ unsigned char aff : 3;
+ unsigned char spare : 5;
+} tvFiler2_reg;
+
+typedef struct
+{
+ unsigned char hai : 3;
+ unsigned char hti : 3;
+ unsigned char reserved : 1;
+ unsigned char hvauto : 1;
+} inputTiming1_reg;
+
+typedef struct
+{
+ unsigned char ho : 3;
+ unsigned char hw : 2;
+ unsigned char spare : 3;
+} inputTiming4_reg;
+
+typedef struct
+{
+ unsigned char ho : 2;
+ unsigned char vti : 2;
+ unsigned char vo : 2;
+ unsigned char spare : 2;
+} inputTiming7_reg;
+
+typedef struct
+{
+ unsigned char dotcr13 : 1;
+ unsigned char bsdadj : 3;
+ unsigned char aciv : 1;
+ unsigned char spare : 3;
+} burstAmplitude_reg;
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-09 22:43:06
|
Revision: 622
http://armadeus.svn.sourceforge.net/armadeus/?rev=622&view=rev
Author: artemys
Date: 2007-08-09 15:43:03 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[BUILDROOT] Activate Tslib in Buildroot
Modified Paths:
--------------
trunk/buildroot/package/tslib/tslib.mk
Added Paths:
-----------
trunk/patches/023-buildroot-tslib.diff
Modified: trunk/buildroot/package/tslib/tslib.mk
===================================================================
--- trunk/buildroot/package/tslib/tslib.mk 2007-08-09 22:30:38 UTC (rev 621)
+++ trunk/buildroot/package/tslib/tslib.mk 2007-08-09 22:43:03 UTC (rev 622)
@@ -72,8 +72,11 @@
tslib-clean:
$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(TSLIB_DIR) uninstall
-$(MAKE) -C $(TSLIB_DIR) clean
+ rm $(TSLIB_DIR)/.compiled
+ rm $(STAGING_DIR)/usr/lib/libts*
+ rm $(TARGET_DIR)/usr/lib/libts*
-tslib-dirclean:
+tslib-dirclean: clean
rm -rf $(TSLIB_DIR)
#############################################################
Added: trunk/patches/023-buildroot-tslib.diff
===================================================================
--- trunk/patches/023-buildroot-tslib.diff (rev 0)
+++ trunk/patches/023-buildroot-tslib.diff 2007-08-09 22:43:03 UTC (rev 622)
@@ -0,0 +1,10 @@
+--- buildroot/package/Config.in.org 2007-08-10 00:37:23.000000000 +0200
++++ buildroot/package/Config.in 2007-08-10 00:38:14.000000000 +0200
+@@ -147,6 +147,7 @@
+ source "package/tinylogin/Config.in"
+ source "package/tinyx/Config.in"
+ source "package/tn5250/Config.in"
++source "package/tslib/Config.in"
+ source "package/ttcp/Config.in"
+ source "package/udev/Config.in"
+ source "package/udhcp/Config.in"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-09 22:30:36
|
Revision: 621
http://armadeus.svn.sourceforge.net/armadeus/?rev=621&view=rev
Author: artemys
Date: 2007-08-09 15:30:38 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[LINUX] Makes TSC2102 work. (Only touchscreen is currently supported).
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/076-linux-2.6.18-tsc2102-armadeus-patch.diff
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-08-09 19:30:38 UTC (rev 620)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-08-09 22:30:38 UTC (rev 621)
@@ -810,7 +810,7 @@
diff -urN linux-2.6.18.1/arch/arm/mach-imx/apf9328.c linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c
--- linux-2.6.18.1/arch/arm/mach-imx/apf9328.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c 2007-07-22 22:46:57.000000000 +0200
-@@ -0,0 +1,463 @@
+@@ -0,0 +1,466 @@
+/*
+ * linux/arch/arm/mach-imx/apf9328.c
+ *
@@ -1261,6 +1261,9 @@
+#ifdef CONFIG_DM9000
+ set_irq_type(APF9328_ETH_IRQ, IRQF_TRIGGER_LOW);
+#endif // CONFIG_DM9000
++#ifdef CONFIG_SPI_TSC2102
++ set_irq_type( IRQ_GPIOD(8), IRQF_TRIGGER_FALLING );
++#endif // CONFIG_SPI_TSC2102
+}
+
+
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/076-linux-2.6.18-tsc2102-armadeus-patch.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/076-linux-2.6.18-tsc2102-armadeus-patch.diff (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/076-linux-2.6.18-tsc2102-armadeus-patch.diff 2007-08-09 22:30:38 UTC (rev 621)
@@ -0,0 +1,205 @@
+--- linux-2.6.18.1/drivers/input/touchscreen/tsc2102_ts.c 2007-08-02 00:49:55.000000000 +0200
++++ linux-2.6.18.1.mod/drivers/input/touchscreen/tsc2102_ts.c 2007-07-01 19:24:12.000000000 +0200
+@@ -42,8 +42,8 @@
+ }
+
+ input_report_key(dev, BTN_TOUCH, touching);
+-
+- do_poke_blanked_console = 1;
++ //printk("Touch: %d\n", touching);
++ //do_poke_blanked_console = 1; Unknown symbol in 2.6.18.1
+ }
+
+ static void tsc2102_coords(int x, int y, int z1, int z2)
+--- linux-2.6.18.1/drivers/spi/tsc2102.c 2007-08-05 23:03:42.000000000 +0200
++++ linux-2.6.18.1.mod/drivers/spi/tsc2102.c 2007-08-05 22:39:44.000000000 +0200
+@@ -51,7 +51,8 @@
+ #define TSC2102_ADC_T1_CONTROL 0x2bf4
+ #define TSC2102_ADC_T2_CONTROL 0x33f4
+ #define TSC2102_ADC_DAV 0x4000
+-#define TSC2102_ADC_INT_REF 0x0016
++#define TSC2102_ADC_INT_REF_125 0x0016
++#define TSC2102_ADC_INT_REF_250 0x0017
+ #define TSC2102_ADC_EXT_REF 0x0002
+ #define TSC2102_CONFIG_TIMES 0x0008
+ #define TSC2102_RESET 0xbb00
+@@ -87,7 +88,7 @@
+ struct tsc2102_dev {
+ struct tsc2102_config *pdata;
+ spinlock_t lock, lock_sync;
+- struct clk *bclk_ck;
++// struct clk *bclk_ck; TODO add clock mechanism to i.MX ???
+
+ int state; /* 0: TS, 1: Portscan, 2-3: Temps */
+ struct timer_list ts_timer; /* Busy-wait for PEN UP */
+@@ -307,7 +308,9 @@
+ }
+
+ tsc2102_cb_register_func(touch_cb, tsc2102_touch_t)
++EXPORT_SYMBOL(tsc2102_touch_cb);
+ tsc2102_cb_register_func(coords_cb, tsc2102_coords_t)
++EXPORT_SYMBOL(tsc2102_coords_cb);
+ tsc2102_cb_register_func(ports_cb, tsc2102_ports_t)
+ tsc2102_cb_register_func(temp1_cb, tsc2102_temp_t)
+ tsc2102_cb_register_func(temp2_cb, tsc2102_temp_t)
+@@ -411,22 +414,25 @@
+ TSC2102_TS_ADC_CTRL, TSC2102_ADC_ADST,
+ tsc2102_complete_dummy);
+
+- dev->state ++;
++ //dev->state ++;
+ tsc2102_mode(dev);
+ }
+
+ static void tsc2102_check_status(struct tsc2102_dev *dev);
+
+-/* TSC has new data for us availiable. */
+-static irqreturn_t tsc2102_handler(int irq, void *dev_id)
++/* TSC has new data for us available. */
++static irqreturn_t tsc2102_handler(int irq, void *dev_id, struct pt_regs *regs)
+ {
+ struct tsc2102_dev *dev = (struct tsc2102_dev *) dev_id;
+ spin_lock_irq(&dev->lock);
+
+- if (!dev->data_pending)
++ if (!dev->data_pending)
++ {
++ dev->data_pending = 1;
+ tsc2102_check_status(dev);
+-
+- dev->data_pending ++;
++ }
++
++// dev->data_pending ++;
+
+ spin_unlock_irq(&dev->lock);
+ return IRQ_HANDLED;
+@@ -464,7 +470,7 @@
+
+ spin_lock_irq(&dev->lock);
+
+- dev->data_pending --;
++ dev->data_pending=0; // --
+
+ /*
+ * This may happen if the registers were successfully read and a
+@@ -474,8 +480,8 @@
+ if (dev->data_pending)
+ tsc2102_check_status(dev);
+
+- if (dev->status & (TSC2102_PS_DAV | TSC2102_T1_DAV | TSC2102_T2_DAV))
+- tsc2102_new_mode(dev);
++// if (dev->status & (TSC2102_PS_DAV | TSC2102_T1_DAV | TSC2102_T2_DAV))
++// tsc2102_new_mode(dev);
+
+ spin_unlock_irq(&dev->lock);
+ }
+@@ -486,6 +492,7 @@
+ * Read all converted data from corresponding registers
+ * so that the ADC can move on to a new conversion.
+ */
++
+ if (dev->status & TSC2102_TS_DAV) {
+ tsc2102_reads_async(&dev->req_adc, TSC2102_TS_X,
+ dev->adc_data, 4, tsc2102_data_report);
+@@ -517,7 +524,7 @@
+ if (!(dev->status & (TSC2102_TS_DAV | TSC2102_PS_DAV |
+ TSC2102_T1_DAV | TSC2102_T2_DAV))) {
+ spin_lock_irq(&dev->lock);
+- dev->data_pending --;
++ dev->data_pending=0; //--
+ spin_unlock_irq(&dev->lock);
+
+ WARN_ON(!dev->state);
+@@ -539,8 +546,8 @@
+
+ tsc2102_new_mode(dev);
+
+- mod_timer(&dev->mode_timer, jiffies +
+- msecs_to_jiffies(dev->mode_msecs));
++/* mod_timer(&dev->mode_timer, jiffies +
++ msecs_to_jiffies(dev->mode_msecs));*/
+ spin_unlock_irq(&dev->lock);
+ }
+
+@@ -786,7 +793,7 @@
+
+ /* Reference mode, 100 usec delay, 1.25 V reference */
+ if (dev->pdata->use_internal)
+- tsc2102_write_sync(TSC2102_TS_REF_CTRL, TSC2102_ADC_INT_REF);
++ tsc2102_write_sync(TSC2102_TS_REF_CTRL, TSC2102_ADC_INT_REF_250);
+ else
+ tsc2102_write_sync(TSC2102_TS_REF_CTRL, TSC2102_ADC_EXT_REF);
+
+@@ -986,7 +993,7 @@
+ {
+ struct tsc2102_config *pdata = spi->dev.platform_data;
+ struct spi_transfer *spi_buffer;
+- int err = 0;
++ int err = -EINVAL;
+
+ if (!pdata) {
+ printk(KERN_ERR "TSC2102: Platform data not supplied\n");
+@@ -1021,21 +1028,23 @@
+ tsc2102_request_alloc(&tsc, &tsc.req_mode, 1, 1, &spi_buffer);
+
+ spin_lock_init(&tsc.lock);
++ spin_lock_init(&tsc.lock_sync); // If think its better no ?
+ spin_lock(&tsc.lock_sync);
+
+ /* Get the BCLK - assuming the rate is at 12000000 */
+- tsc.bclk_ck = clk_get(0, "bclk");
++#ifdef IMX_CLOCK_CONFIG
++ tsc.bclk_ck = clk_get(0, "bclk"); TODO add clock mechanism to i.MX ???
+ if (!tsc.bclk_ck) {
+ printk(KERN_ERR "Unable to get the clock BCLK\n");
+ err = -EPERM;
+ goto done;
+ }
+-
++
+ clk_enable(tsc.bclk_ck);
++#endif //IMX_CLOCK_CONFIG
+
+- if (request_irq(spi->irq, tsc2102_handler, IRQF_SAMPLE_RANDOM |
+- IRQF_TRIGGER_FALLING, "tsc2102", &tsc)) {
+- printk(KERN_ERR "Could not allocate touchscreen IRQ!\n");
++ if (request_irq(spi->irq, tsc2102_handler, IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_FALLING, "tsc2102", &tsc)) {
++ printk(KERN_ERR "Could not allocate touchscreen IRQ (n %d)\n", spi->irq);
+ err = -EINVAL;
+ goto err_clk;
+ }
+@@ -1056,7 +1065,7 @@
+
+ /* Now try to detect the chip, make first contact */
+ if (tsc2102_get_revision() != 0x1) {
+- printk(KERN_ERR "No TI TSC2102 chip found!\n");
++ printk(KERN_ERR "No TI TSC2102 chip found! Bad revision: %x\n", tsc2102_get_revision());
+ goto err_timer;
+ }
+
+@@ -1120,10 +1129,11 @@
+ del_timer(&tsc.mode_timer);
+ dev_set_drvdata(&spi->dev, NULL);
+ err_clk:
+- clk_disable(tsc.bclk_ck);
+- clk_put(tsc.bclk_ck);
++/* clk_disable(tsc.bclk_ck); TODO add clock mechanism to i.MX ???
++ clk_put(tsc.bclk_ck);*/
+ done:
+ spin_unlock(&tsc.lock_sync);
++
+ return err;
+ }
+
+@@ -1139,8 +1149,8 @@
+ dev_set_drvdata(&spi->dev, NULL);
+
+ /* Release the BCLK */
+- clk_disable(dev->bclk_ck);
+- clk_put(dev->bclk_ck);
++/* clk_disable(dev->bclk_ck); TODO add clock mechanism to i.MX ???
++ clk_put(dev->bclk_ck); */
+
+ del_timer(&tsc.mode_timer);
+ del_timer(&tsc.ts_timer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2007-08-09 19:30:45
|
Revision: 620
http://armadeus.svn.sourceforge.net/armadeus/?rev=620&view=rev
Author: jorasse
Date: 2007-08-09 12:30:38 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[buildroot] merged alsa lib and utils packages for evaluation purpose
Added Paths:
-----------
trunk/patches/022-buildroot-alsa-lib-utils.diff
Added: trunk/patches/022-buildroot-alsa-lib-utils.diff
===================================================================
--- trunk/patches/022-buildroot-alsa-lib-utils.diff (rev 0)
+++ trunk/patches/022-buildroot-alsa-lib-utils.diff 2007-08-09 19:30:38 UTC (rev 620)
@@ -0,0 +1,285 @@
+--- buildroot/package/alsa-lib/alsa-lib.mk
++++ buildroot/package/alsa-lib/alsa-lib.mk
+@@ -0,0 +1,75 @@
++#############################################################
++#
++# alsa-lib
++#
++#############################################################
++ALSA_LIB_VERSION:=1.0.14a
++ALSA_LIB_SOURCE:=alsa-lib-$(ALSA_LIB_VERSION).tar.bz2
++ALSA_LIB_SITE:=ftp://ftp.alsa-project.org/pub/lib
++ALSA_LIB_DIR:=$(BUILD_DIR)/alsa-lib-$(ALSA_LIB_VERSION)
++ALSA_LIB_CAT:=bzcat
++ALSA_LIB_BINARY:=libasound.so.2.0.0
++ALSA_LIB_TARGET_BINARY:=usr/lib/$(ALSA_LIB_BINARY)
++
++$(DL_DIR)/$(ALSA_LIB_SOURCE):
++ $(WGET) -P $(DL_DIR) $(ALSA_LIB_SITE)/$(ALSA_LIB_SOURCE)
++
++$(ALSA_LIB_DIR)/.unpacked: $(DL_DIR)/$(ALSA_LIB_SOURCE)
++ $(ALSA_LIB_CAT) $(DL_DIR)/$(ALSA_LIB_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
++ toolchain/patch-kernel.sh $(ALSA_LIB_DIR) package/alsa-lib/ alsa-lib-$(ALSA_LIB_VERSION)\*.patch*
++ $(CONFIG_UPDATE) $(ALSA_LIB_DIR)
++ touch $@
++
++$(ALSA_LIB_DIR)/.configured: $(ALSA_LIB_DIR)/.unpacked
++ (cd $(ALSA_LIB_DIR); rm -rf config.cache; \
++ $(TARGET_CONFIGURE_ARGS) \
++ $(TARGET_CONFIGURE_OPTS) \
++ CFLAGS="$(TARGET_CFLAGS)" \
++ LDFLAGS="$(TARGET_LDFLAGS)" \
++ ./configure \
++ --target=$(GNU_TARGET_NAME) \
++ --host=$(GNU_TARGET_NAME) \
++ --build=$(GNU_HOST_NAME) \
++ --prefix=/usr \
++ --sysconfdir=/etc \
++ --enable-shared \
++ --enable-static \
++ --disable-docs \
++ $(DISABLE_NLS) \
++ );
++ touch $@
++
++$(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY): $(ALSA_LIB_DIR)/.configured
++ $(MAKE) -C $(ALSA_LIB_DIR)
++ touch -c $@
++
++$(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY): $(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY)
++ $(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_LIB_DIR) install
++ $(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/usr/lib\',g" $(STAGING_DIR)/usr/lib/libasound.la
++
++$(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY): $(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY)
++ mkdir -p $(TARGET_DIR)/usr/share/alsa
++ mkdir -p $(TARGET_DIR)/usr/lib/alsa-lib
++ cp -dpf $(STAGING_DIR)/usr/lib/libasound.so* $(TARGET_DIR)/usr/lib/
++ cp -rdpf $(STAGING_DIR)/usr/share/alsa/* $(TARGET_DIR)/usr/share/alsa/
++ cp -rdpf $(STAGING_DIR)/usr/lib/alsa-lib/* $(TARGET_DIR)/usr/lib/alsa-lib/
++ -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libasound.so*
++ -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/alsa-lib/*.so
++ touch -c $@
++
++alsa-lib: linux uclibc $(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY)
++
++alsa-lib-clean:
++ rm -f $(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY)
++ -$(MAKE) -C $(ALSA_LIB_DIR) clean
++
++alsa-lib-dirclean:
++ rm -rf $(ALSA_LIB_DIR)
++#############################################################
++#
++# Toplevel Makefile options
++#
++#############################################################
++ifeq ($(strip $(BR2_PACKAGE_ALSA_LIB)),y)
++TARGETS+=alsa-lib
++endif
+--- buildroot/package/alsa-lib/Config.in
++++ buildroot/package/alsa-lib/Config.in
+@@ -0,0 +1,8 @@
++config BR2_PACKAGE_ALSA_LIB
++ bool "alsa-lib"
++ default n
++ help
++ The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
++ functionality to the Linux operating system.
++
++ http://www.alsa-project.org/
+--- buildroot/package/alsa-utils/alsa-utils.mk
++++ buildroot/package/alsa-utils/alsa-utils.mk
+@@ -0,0 +1,94 @@
++#############################################################
++#
++# alsa-utils
++#
++#############################################################
++ALSA_UTILS_VERSION:=1.0.14
++ALSA_UTILS_SOURCE:=alsa-utils-$(ALSA_UTILS_VERSION).tar.bz2
++ALSA_UTILS_SITE:=ftp://ftp.alsa-project.org/pub/utils
++ALSA_UTILS_DIR:=$(BUILD_DIR)/alsa-utils-$(ALSA_UTILS_VERSION)
++ALSA_UTILS_CAT:=bzcat
++ALSA_UTILS_BINARY:=alsactl/alsactl
++ALSA_UTILS_TARGET_BINARY:=usr/sbin/alsactl
++
++$(DL_DIR)/$(ALSA_UTILS_SOURCE):
++ $(WGET) -P $(DL_DIR) $(ALSA_UTILS_SITE)/$(ALSA_UTILS_SOURCE)
++
++$(ALSA_UTILS_DIR)/.unpacked: $(DL_DIR)/$(ALSA_UTILS_SOURCE)
++ $(ALSA_UTILS_CAT) $(DL_DIR)/$(ALSA_UTILS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
++ toolchain/patch-kernel.sh $(ALSA_UTILS_DIR) package/alsa-utils/ alsa-utils-$(ALSA_UTILS_VERSION)\*.patch\*
++ $(CONFIG_UPDATE) $(ALSA_UTILS_DIR)
++ touch $@
++
++$(ALSA_UTILS_DIR)/.configured: $(ALSA_UTILS_DIR)/.unpacked
++ (cd $(ALSA_UTILS_DIR); \
++ $(TARGET_CONFIGURE_OPTS) \
++ $(TARGET_CONFIGURE_ARGS) \
++ CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
++ LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
++ ./configure \
++ --target=$(GNU_TARGET_NAME) \
++ --host=$(GNU_TARGET_NAME) \
++ --build=$(GNU_HOST_NAME) \
++ --prefix=/usr \
++ );
++ touch $@
++
++$(ALSA_UTILS_DIR)/$(ALSA_UTILS_BINARY): $(ALSA_UTILS_DIR)/.configured
++ $(MAKE) CC=$(TARGET_CC) -C $(ALSA_UTILS_DIR)
++ touch -c $@
++
++ALSA_UTILS_TARGETS_ :=
++ALSA_UTILS_TARGETS_y :=
++
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ALSACONF) += usr/sbin/alsaconf
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ALSACTL) += usr/sbin/alsactl
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ALSAMIXER) += usr/bin/alsamixer
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_AMIDI) += usr/bin/amidi
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_AMIXER) += usr/bin/amixer
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_APLAY) += usr/bin/aplay
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ARECORD) += usr/bin/arecord
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_IECSET) += usr/bin/iecset
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ACONNECT) += usr/bin/aconnect
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_APLAYMIDI) += usr/bin/aplaymidi
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI) += usr/bin/arecordmidi
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ASEQDUMP) += usr/bin/aseqdump
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_ASEQNET) += usr/bin/aseqnet
++ALSA_UTILS_TARGETS_$(BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST) += usr/bin/speaker-test
++
++$(TARGET_DIR)/$(ALSA_UTILS_TARGET_BINARY): $(ALSA_UTILS_DIR)/$(ALSA_UTILS_BINARY)
++ $(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_UTILS_DIR) install
++ mkdir -p $(TARGET_DIR)/usr/bin
++ mkdir -p $(TARGET_DIR)/usr/sbin
++ for file in $(ALSA_UTILS_TARGETS_y) ; do \
++ cp -dpf $(STAGING_DIR)/$$file $(TARGET_DIR)/$$file; \
++ done
++ if [ -x "$(TARGET_DIR)/usr/bin/speaker-test" ] ; then \
++ mkdir -p $(TARGET_DIR)/usr/share/alsa/speaker-test; \
++ mkdir -p $(TARGET_DIR)/usr/share/sounds/alsa; \
++ cp -rdpf $(STAGING_DIR)/usr/share/alsa/speaker-test/* $(TARGET_DIR)/usr/share/alsa/speaker-test/; \
++ cp -rdpf $(STAGING_DIR)/usr/share/sounds/alsa/* $(TARGET_DIR)/usr/share/sounds/alsa/; \
++ fi;
++ touch -c $@
++
++alsa-utils: uclibc alsa-lib ncurses $(TARGET_DIR)/$(ALSA_UTILS_TARGET_BINARY)
++
++alsa-utils-clean:
++ for file in $(ALSA_UTILS_TARGETS_y) ; do \
++ rm -f $(TARGET_DIR)/$$file; \
++ done
++ for file in $(ALSA_UTILS_TARGETS_) ; do \
++ rm -f $(TARGET_DIR)/$$file; \
++ done
++ -$(MAKE) -C $(ALSA_UTILS_DIR) clean
++
++alsa-utils-dirclean:
++ rm -rf $(ALSA_UTILS_DIR)
++#############################################################
++#
++# Toplevel Makefile options
++#
++#############################################################
++ifeq ($(strip $(BR2_PACKAGE_ALSA_UTILS)),y)
++TARGETS+=alsa-utils
++endif
+--- buildroot/package/alsa-utils/Config.in
++++ buildroot/package/alsa-utils/Config.in
+@@ -0,0 +1,85 @@
++config BR2_PACKAGE_ALSA_UTILS
++ bool "alsa-utils"
++ default n
++ depends on BR2_PACKAGE_ALSA_LIB
++ select BR2_PACKAGE_NCURSES
++ help
++ This package contains the command line utilities for the ALSA
++ project.
++
++ http://www.alsa-project.org/
++
++menu "ALSA utils selection"
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ALSACONF
++ bool "alsaconf"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ALSACTL
++ bool "alsactl"
++ default y
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ALSAMIXER
++ bool "alsamixer"
++ default y
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_AMIDI
++ bool "amidi"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_AMIXER
++ bool "amixer"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_APLAY
++ bool "aplay"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ARECORD
++ bool "arecord"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_IECSET
++ bool "iecset"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ACONNECT
++ bool "aconnect"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_APLAYMIDI
++ bool "aplaymidi"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI
++ bool "arecordmidi"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ASEQDUMP
++ bool "aseqdump"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_ASEQNET
++ bool "aseqnet"
++ default n
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++config BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST
++ bool "speaker-test"
++ default y
++ depends on BR2_PACKAGE_ALSA_UTILS
++
++endmenu
+--- buildroot/package/Config.in
++++ buildroot/package/Config.in
+@@ -26,6 +26,8 @@ source "package/tar/Config.in"
+ comment "Other stuff"
+ source "package/acpid/Config.in"
+ source "package/allegro/Config.in"
++source "package/alsa-lib/Config.in"
++source "package/alsa-utils/Config.in"
+ source "package/asterisk/Config.in"
+ source "package/at/Config.in"
+ source "package/autoconf/Config.in"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-09 17:15:55
|
Revision: 619
http://armadeus.svn.sourceforge.net/armadeus/?rev=619&view=rev
Author: artemys
Date: 2007-08-09 10:15:56 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[BUILDROOT] Add some "ipkg support" scripts
Added Paths:
-----------
trunk/buildroot/scripts/
trunk/buildroot/scripts/ipkg
trunk/buildroot/scripts/make-ipkg-dir.sh
trunk/buildroot/scripts/make-kmod-control.sh
Added: trunk/buildroot/scripts/ipkg
===================================================================
--- trunk/buildroot/scripts/ipkg (rev 0)
+++ trunk/buildroot/scripts/ipkg 2007-08-09 17:15:56 UTC (rev 619)
@@ -0,0 +1,1185 @@
+#!/bin/sh
+# ipkg - the itsy package management system
+#
+# Copyright (C) 2001 Carl D. Worth
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+set -e
+
+# By default do not do globbing. Any command wanting globbing should
+# explicitly enable it first and disable it afterwards.
+set -o noglob
+
+ipkg_is_upgrade () {
+ local A B a b
+ A=$(echo $1 | sed -r "s/([0-9]+)[^[:alnum:]]*/ \1 /g").
+ B=$(echo $2 | sed -r "s/([0-9]+)[^[:alnum:]]*/ \1 /g").
+ while [ \! -z "$A" ] && [ \! -z "$B" ]; do {
+ set $A; a=$1; shift; A=$*
+ set $B; b=$1; shift; B=$*
+ [ "$a" -lt "$b" ] 2>&- && return 1
+ { [ "$a" -gt "$b" ] 2>&- || [ "$a" ">" "$b" ]; } && return
+ }; done
+ return 1
+}
+
+ipkg_srcs() {
+ local srcre="$1"
+ sed -ne "s/^src[[:space:]]\+$srcre[[:space:]]\+//p" < $IPKG_CONF
+}
+
+ipkg_src_names() {
+ sed -ne "s/^src[[:space:]]\+\([^[:space:]]\+\).*/\1/p" < $IPKG_CONF
+}
+
+ipkg_src_byname() {
+ local src="$1"
+ ipkg_srcs $src | head -n 1
+}
+
+ipkg_dests() {
+ local destre="`echo $1 | ipkg_protect_slashes`"
+ sed -ne "/^dest[[:space:]]\+$destre/{
+s/^dest[[:space:]]\+[^[:space:]]\+[[:space:]]\+//
+s/^/`echo $IPKG_OFFLINE_ROOT | ipkg_protect_slashes`/
+p
+}" < $IPKG_CONF
+}
+
+ipkg_dest_names() {
+ sed -ne "s/^dest[[:space:]]\+\([^[:space:]]\+\).*/\1/p" < $IPKG_CONF
+}
+
+ipkg_dests_all() {
+ ipkg_dests '.*'
+}
+
+ipkg_state_dirs() {
+ ipkg_dests_all | sed "s|\$|/$IPKG_DIR_PREFIX|"
+}
+
+ipkg_dest_default() {
+ ipkg_dests_all | head -n 1
+}
+
+ipkg_dest_default_name() {
+ ipkg_dest_names | head -n 1
+}
+
+ipkg_dest_byname() {
+ local dest="$1"
+ ipkg_dests $dest | head -n 1
+}
+
+ipkg_option() {
+ local option="$1"
+ sed -ne "s/^option[[:space:]]\+$option[[:space:]]\+//p" < $IPKG_CONF
+}
+
+ipkg_load_configuration() {
+ if [ -z "$IPKG_CONF_DIR" ]; then
+ IPKG_CONF_DIR=/etc
+ fi
+
+ IPKG_CONF="$IPKG_CONF_DIR/ipkg.conf"
+
+ if [ -z "$IPKG_OFFLINE_ROOT" ]; then
+ IPKG_OFFLINE_ROOT="`ipkg_option offline_root`"
+ fi
+ # Export IPKG_OFFLINE_ROOT for use by update-alternatives
+ export IPKG_OFFLINE_ROOT
+ if [ -n "$DEST_NAME" ]; then
+ IPKG_ROOT="`ipkg_dest_byname $DEST_NAME`"
+ if [ -z "$IPKG_ROOT" ]; then
+ if [ -d "$IPKG_OFFLINE_ROOT$DEST_NAME" ]; then
+ IPKG_ROOT="$IPKG_OFFLINE_ROOT$DEST_NAME";
+ else
+ echo "ipkg: invalid destination specification: $DEST_NAME
+Valid destinations are directories or one of the dest names from $IPKG_CONF:" >&2
+ ipkg_dest_names >&2
+ return 1
+ fi
+ fi
+ else
+ IPKG_ROOT="`ipkg_dest_default`"
+ fi
+
+ # Global ipkg state directories
+ IPKG_DIR_PREFIX=usr/lib/ipkg
+ IPKG_LISTS_DIR=$IPKG_OFFLINE_ROOT/$IPKG_DIR_PREFIX/lists
+ IPKG_PENDING_DIR=$IPKG_OFFLINE_ROOT/$IPKG_DIR_PREFIX/pending
+ if [ -z "$IPKG_TMP" ]; then
+ IPKG_TMP=$IPKG_ROOT/tmp/ipkg
+ fi
+
+ [ -e "$IPKG_TMP" ] || mkdir -p $IPKG_TMP
+
+ # Destination specific ipkg meta-data directory
+ IPKG_STATE_DIR=$IPKG_ROOT/$IPKG_DIR_PREFIX
+
+ # Proxy Support
+ IPKG_PROXY_USERNAME="`ipkg_option proxy_username`"
+ IPKG_PROXY_PASSWORD="`ipkg_option proxy_password`"
+ IPKG_HTTP_PROXY="`ipkg_option http_proxy`"
+ IPKG_FTP_PROXY="`ipkg_option ftp_proxy`"
+ IPKG_NO_PROXY="`ipkg_option no_proxy`"
+ if [ -n "$IPKG_HTTP_PROXY" ]; then
+ export http_proxy="$IPKG_HTTP_PROXY"
+ fi
+
+ if [ -n "$IPKG_FTP_PROXY" ]; then
+ export ftp_proxy="$IPKG_FTP_PROXY"
+ fi
+
+ if [ -n "$IPKG_NO_PROXY" ]; then
+ export no_proxy="$IPKG_NO_PROXY"
+ fi
+
+ IPKG_STATUS_FIELDS='\(Package\|Status\|Essential\|Version\|Conffiles\|Root\)'
+}
+
+ipkg_usage() {
+ [ $# -gt 0 ] && echo "ipkg: $*"
+ echo "
+usage: ipkg [options...] sub-command [arguments...]
+where sub-command is one of:
+
+Package Manipulation:
+ update Update list of available packages
+ upgrade Upgrade all installed packages to latest version
+ install <pkg> Download and install <pkg> (and dependencies)
+ install <file.ipk> Install package <file.ipk>
+ install <file.deb> Install package <file.deb>
+ remove <pkg> Remove package <pkg>
+
+Informational Commands:
+ list List available packages and descriptions
+ files <pkg> List all files belonging to <pkg>
+ search <file> Search for a packaging providing <file>
+ info [pkg [<field>]] Display all/some info fields for <pkg> or all
+ status [pkg [<field>]] Display all/some status fields for <pkg> or all
+ depends <pkg> Print uninstalled package dependencies for <pkg>
+
+Options:
+ -d <dest_name> Use <dest_name> as the the root directory for
+ -dest <dest_name> package installation, removal, upgrading.
+ <dest_name> should be a defined dest name from the
+ configuration file, (but can also be a directory
+ name in a pinch).
+ -o <offline_root> Use <offline_root> as the root for offline installation.
+ -offline <offline_root>
+
+Force Options (use when ipkg is too smart for its own good):
+ -force-depends Make dependency checks warnings instead of errors
+ -force-defaults Use default options for questions asked by ipkg.
+ (no prompts). Note that this will not prevent
+ package installation scripts from prompting.
+" >&2
+ exit 1
+}
+
+ipkg_dir_part() {
+ local dir="`echo $1 | sed -ne 's/\(.*\/\).*/\1/p'`"
+ if [ -z "$dir" ]; then
+ dir="./"
+ fi
+ echo $dir
+}
+
+ipkg_file_part() {
+ echo $1 | sed 's/.*\///'
+}
+
+ipkg_protect_slashes() {
+ sed -e 's/\//\\\//g'
+}
+
+ipkg_download() {
+ local src="$1"
+ local dest="$2"
+
+ local src_file="`ipkg_file_part $src`"
+ local dest_dir="`ipkg_dir_part $dest`"
+ if [ -z "$dest_dir" ]; then
+ dest_dir="$IPKG_TMP"
+ fi
+
+ local dest_file="`ipkg_file_part $dest`"
+ if [ -z "$dest_file" ]; then
+ dest_file="$src_file"
+ fi
+
+ # Proxy support
+ local proxyuser=""
+ local proxypassword=""
+ local proxyoption=""
+
+ if [ -n "$IPKG_PROXY_USERNAME" ]; then
+ proxyuser="--proxy-user=\"$IPKG_PROXY_USERNAME\""
+ proxypassword="--proxy-passwd=\"$IPKG_PROXY_PASSWORD\""
+ fi
+
+ if [ -n "$IPKG_PROXY_HTTP" -o -n "$IPKG_PROXY_FTP" ]; then
+ proxyoption="--proxy=on"
+ fi
+
+ echo "Downloading $src ..."
+ rm -f $IPKG_TMP/$src_file
+ case "$src" in
+ http://* | ftp://*)
+ if ! wget --passive-ftp $proxyoption $proxyuser $proxypassword -P $IPKG_TMP $src; then
+ echo "ipkg_download: ERROR: Failed to retrieve $src, returning $err"
+ return 1
+ fi
+ mv $IPKG_TMP/$src_file $dest_dir/$dest_file 2>/dev/null
+ ;;
+ file:/* )
+ ln -s `echo $src | sed 's/^file://'` $dest_dir/$dest_file 2>/dev/null
+ ;;
+ *)
+ echo "DEBUG: $src"
+ ;;
+ esac
+
+ echo "Done."
+ return 0
+}
+
+ipkg_update() {
+ if [ ! -e "$IPKG_LISTS_DIR" ]; then
+ mkdir -p $IPKG_LISTS_DIR
+ fi
+
+ local err=
+ for src_name in `ipkg_src_names`; do
+ local src="`ipkg_src_byname $src_name`"
+ if ! ipkg_download $src/Packages $IPKG_LISTS_DIR/$src_name; then
+ echo "ipkg_update: Error downloading $src/Packages to $IPKG_LISTS_DIR/$src_name" >&2
+ err=t
+ else
+ echo "Updated list of available packages in $IPKG_LISTS_DIR/$src_name"
+ fi
+ done
+
+ [ -n "$err" ] && return 1
+
+ return 0
+}
+
+ipkg_list() {
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+# black magic...
+sed -ne "
+/^Package:/{
+s/^Package:[[:space:]]*\<\([a-z0-9.+-]*$1[a-z0-9.+-]*\).*/\1/
+h
+}
+/^Description:/{
+s/^Description:[[:space:]]*\(.*\)/\1/
+H
+g
+s/\\
+/ - /
+p
+}
+" $IPKG_LISTS_DIR/$src
+ fi
+ done
+}
+
+ipkg_extract_paragraph() {
+ local pkg="$1"
+ sed -ne "/Package:[[:space:]]*$pkg[[:space:]]*\$/,/^\$/p"
+}
+
+ipkg_extract_field() {
+ local field="$1"
+# blacker magic...
+ sed -ne "
+: TOP
+/^$field:/{
+p
+n
+b FIELD
+}
+d
+: FIELD
+/^$/b TOP
+/^[^[:space:]]/b TOP
+p
+n
+b FIELD
+"
+}
+
+ipkg_extract_value() {
+ sed -e "s/^[^:]*:[[:space:]]*//"
+}
+
+ipkg_require_list() {
+ [ $# -lt 1 ] && return 1
+ local src="$1"
+ if [ ! -f "$IPKG_LISTS_DIR/$src" ]; then
+ echo "ERROR: File not found: $IPKG_LISTS_DIR/$src" >&2
+ echo " You probably want to run \`ipkg update'" >&2
+ return 1
+ fi
+ return 0
+}
+
+ipkg_info() {
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+ case $# in
+ 0)
+ cat $IPKG_LISTS_DIR/$src
+ ;;
+ 1)
+ ipkg_extract_paragraph $1 < $IPKG_LISTS_DIR/$src
+ ;;
+ *)
+ ipkg_extract_paragraph $1 < $IPKG_LISTS_DIR/$src | ipkg_extract_field $2
+ ;;
+ esac
+ fi
+ done
+}
+
+ipkg_status_sd() {
+ [ $# -lt 1 ] && return 0
+ sd="$1"
+ shift
+ if [ -f $sd/status ]; then
+ case $# in
+ 0)
+ cat $sd/status
+ ;;
+ 1)
+ ipkg_extract_paragraph $1 < $sd/status
+ ;;
+ *)
+ ipkg_extract_paragraph $1 < $sd/status | ipkg_extract_field $2
+ ;;
+ esac
+ fi
+ return 0
+}
+
+ipkg_status_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_sd $sd $*
+ done
+}
+
+ipkg_status() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_all $*
+ fi
+}
+
+ipkg_status_matching_sd() {
+ local sd="$1"
+ local re="$2"
+ if [ -f $sd/status ]; then
+ sed -ne "
+: TOP
+/^Package:/{
+s/^Package:[[:space:]]*//
+s/[[:space:]]*$//
+h
+}
+/$re/{
+g
+p
+b NEXT
+}
+d
+: NEXT
+/^$/b TOP
+n
+b NEXT
+" < $sd/status
+ fi
+ return 0
+}
+
+ipkg_status_matching_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_matching_sd $sd $*
+ done
+}
+
+ipkg_status_matching() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_matching_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_matching_all $*
+ fi
+}
+
+ipkg_status_installed_sd() {
+ local sd="$1"
+ local pkg="$2"
+ ipkg_status_sd $sd $pkg Status | grep -q "Status: install ok installed"
+}
+
+ipkg_status_installed_all() {
+ local ret=1
+ for sd in `ipkg_state_dirs`; do
+ if `ipkg_status_installed_sd $sd $*`; then
+ ret=0
+ fi
+ done
+ return $ret
+}
+
+ipkg_status_mentioned_sd() {
+ local sd="$1"
+ local pkg="$2"
+ [ -n "`ipkg_status_sd $sd $pkg Status`" ]
+}
+
+ipkg_files() {
+ local pkg="$1"
+ if [ -n "$DEST_NAME" ]; then
+ dests=$IPKG_ROOT
+ else
+ dests="`ipkg_dests_all`"
+ fi
+ for dest in $dests; do
+ if [ -f $dest/$IPKG_DIR_PREFIX/info/$pkg.list ]; then
+ dest_sed="`echo $dest | ipkg_protect_slashes`"
+ sed -e "s/^/$dest_sed/" < $dest/$IPKG_DIR_PREFIX/info/$pkg.list
+ fi
+ done
+}
+
+ipkg_search() {
+ local pattern="$1"
+
+ for dest_name in `ipkg_dest_names`; do
+ dest="`ipkg_dest_byname $dest_name`"
+ dest_sed="`echo $dest | ipkg_protect_slashes`"
+
+ set +o noglob
+ local list_files="`ls -1 $dest/$IPKG_DIR_PREFIX/info/*.list 2>/dev/null`"
+ set -o noglob
+ for file in $list_files; do
+ if sed "s/^/$dest_sed/" $file | grep -q $pattern; then
+ local pkg="`echo $file | sed "s/^.*\/\(.*\)\.list/\1/"`"
+ [ "$dest_name" != `ipkg_dest_default_name` ] && pkg="$pkg ($dest_name)"
+ sed "s/^/$dest_sed/" $file | grep $pattern | sed "s/^/$pkg: /"
+ fi
+ done
+ done
+}
+
+ipkg_status_remove_sd() {
+ local sd="$1"
+ local pkg="$2"
+
+ if [ ! -f $sd/status ]; then
+ mkdir -p $sd
+ touch $sd/status
+ fi
+ sed -ne "/Package:[[:space:]]*$pkg[[:space:]]*\$/,/^\$/!p" < $sd/status > $sd/status.new
+ mv $sd/status.new $sd/status
+}
+
+ipkg_status_remove_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_remove_sd $sd $*
+ done
+}
+
+ipkg_status_remove() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_remove_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_remove_all $*
+ fi
+}
+
+ipkg_status_update_sd() {
+ local sd="$1"
+ local pkg="$2"
+
+ ipkg_status_remove_sd $sd $pkg
+ ipkg_extract_field "$IPKG_STATUS_FIELDS" >> $sd/status
+ echo "" >> $sd/status
+}
+
+ipkg_status_update() {
+ ipkg_status_update_sd $IPKG_STATE_DIR $*
+}
+
+ipkg_unsatisfied_dependences() {
+ local pkg=$1
+ local deps="`ipkg_get_depends $pkg`"
+ local remaining_deps=
+ for dep in $deps; do
+ local installed="`ipkg_get_installed $dep`"
+ if [ "$installed" != "installed" ] ; then
+ remaining_deps="$remaining_deps $dep"
+ fi
+ done
+ ## echo "ipkg_unsatisfied_dependences pkg=$pkg $remaining_deps" > /dev/console
+ echo $remaining_deps
+}
+
+ipkg_safe_pkg_name() {
+ local pkg=$1
+ local spkg="`echo pkg_$pkg | sed -e y/-+./___/`"
+ echo $spkg
+}
+
+ipkg_set_depends() {
+ local pkg=$1; shift
+ local new_deps="$*"
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ ## setvar ${pkg}_depends "$new_deps"
+ echo $new_deps > $IPKG_TMP/${pkg}.depends
+}
+
+ipkg_get_depends() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ cat $IPKG_TMP/${pkg}.depends
+ ## eval "echo \$${pkg}_depends"
+}
+
+ipkg_set_installed() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ echo installed > $IPKG_TMP/${pkg}.installed
+ ## setvar ${pkg}_installed "installed"
+}
+
+ipkg_set_uninstalled() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ ### echo ipkg_set_uninstalled $pkg > /dev/console
+ echo uninstalled > $IPKG_TMP/${pkg}.installed
+ ## setvar ${pkg}_installed "uninstalled"
+}
+
+ipkg_get_installed() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ if [ -f $IPKG_TMP/${pkg}.installed ]; then
+ cat $IPKG_TMP/${pkg}.installed
+ fi
+ ## eval "echo \$${pkg}_installed"
+}
+
+ipkg_depends() {
+ local new_pkgs="$*"
+ local all_deps=
+ local installed_pkgs="`ipkg_status_matching_all 'Status:.*[[:space:]]installed'`"
+ for pkg in $installed_pkgs; do
+ ipkg_set_installed $pkg
+ done
+ while [ -n "$new_pkgs" ]; do
+ all_deps="$all_deps $new_pkgs"
+ local new_deps=
+ for pkg in $new_pkgs; do
+ if echo $pkg | grep -q '[^a-z0-9.+-]'; then
+ echo "ipkg_depends: ERROR: Package name $pkg contains illegal characters (should be [a-z0-9.+-])" >&2
+ return 1
+ fi
+ # TODO: Fix this. For now I am ignoring versions and alternations in dependencies.
+ new_deps="$new_deps "`ipkg_info $pkg '\(Pre-\)\?Depends' | ipkg_extract_value | sed -e 's/([^)]*)//g
+s/\(|[[:space:]]*[a-z0-9.+-]\+[[:space:]]*\)\+//g
+s/,/ /g
+s/ \+/ /g'`
+ ipkg_set_depends $pkg $new_deps
+ done
+
+ new_deps=`echo $new_deps | sed -e 's/[[:space:]]\+/\n/g' | sort | uniq`
+
+ local maybe_new_pkgs=
+ for pkg in $new_deps; do
+ if ! echo $installed_pkgs | grep -q "\<$pkg\>"; then
+ maybe_new_pkgs="$maybe_new_pkgs $pkg"
+ fi
+ done
+
+ new_pkgs=
+ for pkg in $maybe_new_pkgs; do
+ if ! echo $all_deps | grep -q "\<$pkg\>"; then
+ if [ -z "`ipkg_info $pkg`" ]; then
+ echo "ipkg_depends: Warning: $pkg mentioned in dependency but no package found in $IPKG_LISTS_DIR" >&2
+ ipkg_set_installed $pkg
+ else
+ new_pkgs="$new_pkgs $pkg"
+ ipkg_set_uninstalled $pkg
+ fi
+ else
+ ipkg_set_uninstalled $pkg
+ fi
+ done
+ done
+
+ echo $all_deps
+}
+
+ipkg_get_install_dest() {
+ local dest="$1"
+ shift
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ local requested_pkgs="$*"
+ local pkgs="`ipkg_depends $*`"
+
+ mkdir -p $info_dir
+ for pkg in $pkgs; do
+ if ! ipkg_status_mentioned_sd $sd $pkg; then
+ echo "Package: $pkg
+Status: install ok not-installed" | ipkg_status_update_sd $sd $pkg
+ fi
+ done
+ ## mark the packages that we were directly requested to install as uninstalled
+ for pkg in $requested_pkgs; do ipkg_set_uninstalled $pkg; done
+
+ local new_pkgs=
+ local pkgs_installed=0
+ while [ -n "pkgs" ]; do
+ curcheck=0
+ ## echo "pkgs to install: {$pkgs}" > /dev/console
+ for pkg in $pkgs; do
+ curcheck="`expr $curcheck + 1`"
+ local is_installed="`ipkg_get_installed $pkg`"
+ if [ "$is_installed" = "installed" ]; then
+ echo "$pkg is installed" > /dev/console
+ continue
+ fi
+
+ local remaining_deps="`ipkg_unsatisfied_dependences $pkg`"
+ if [ -n "$remaining_deps" ]; then
+ new_pkgs="$new_pkgs $pkg"
+ ### echo "Dependences not satisfied for $pkg: $remaining_deps"
+ if [ $curcheck -ne `echo $pkgs|wc -w` ]; then
+ continue
+ fi
+ fi
+
+ local filename=
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+ filename="`ipkg_extract_paragraph $pkg < $IPKG_LISTS_DIR/$src | ipkg_extract_field Filename | ipkg_extract_value`"
+ [ -n "$filename" ] && break
+ fi
+ done
+
+ if [ -z "$filename" ]; then
+ echo "ipkg_get_install: ERROR: Cannot find package $pkg in $IPKG_LISTS_DIR"
+ echo "ipkg_get_install: Check the spelling and maybe run \`ipkg update'."
+ ipkg_status_remove_sd $sd $pkg
+ return 1;
+ fi
+
+ echo ""
+ local tmp_pkg_file="$IPKG_TMP/"`ipkg_file_part $filename`
+ if ! ipkg_download `ipkg_src_byname $src`/$filename $tmp_pkg_file; then
+ echo "ipkg_get_install: Perhaps you need to run \`ipkg update'?"
+ return 1
+ fi
+
+ if ! ipkg_install_file_dest $dest $tmp_pkg_file; then
+ echo "ipkg_get_install: ERROR: Failed to install $tmp_pkg_file"
+ echo "ipkg_get_install: I'll leave it there for you to try a manual installation"
+ return 1
+ fi
+
+ ipkg_set_installed $pkg
+ pkgs_installed="`expr $pkgs_installed + 1`"
+ rm $tmp_pkg_file
+ done
+ ### echo "Installed $pkgs_installed package(s) this round"
+ if [ $pkgs_installed -eq 0 ]; then
+ if [ -z "$new_pkgs" ]; then
+ break
+ fi
+ fi
+ pkgs_installed=0
+ pkgs="$new_pkgs"
+ new_pkgs=
+ curcheck=0
+ done
+}
+
+ipkg_get_install() {
+ ipkg_get_install_dest $IPKG_ROOT $*
+}
+
+ipkg_install_file_dest() {
+ local dest="$1"
+ local filename="$2"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ if [ ! -f "$filename" ]; then
+ echo "ipkg_install_file: ERROR: File $filename not found"
+ return 1
+ fi
+
+ local pkg="`ipkg_file_part $filename | sed 's/\([a-z0-9.+-]\+\)_.*/\1/'`"
+ local ext="`echo $filename | sed 's/.*\.//'`"
+ local pkg_extract_stdout
+ if [ "$ext" = "ipk" ]; then
+ pkg_extract_stdout="tar -xzOf"
+ elif [ "$ext" = "deb" ]; then
+ pkg_extract_stdout="ar p"
+ else
+ echo "ipkg_install_file: ERROR: File $filename has unknown extension $ext (not .ipk or .deb)"
+ return 1
+ fi
+
+ # Check dependencies
+ local depends="`ipkg_depends $pkg | sed -e "s/\<$pkg\>//"`"
+
+ # Don't worry about deps that are scheduled for installation
+ local missing_deps=
+ for dep in $depends; do
+ if ! ipkg_status_all $dep | grep -q 'Status:[[:space:]]install'; then
+ missing_deps="$missing_deps $dep"
+ fi
+ done
+
+ if [ ! -z "$missing_deps" ]; then
+ if [ -n "$FORCE_DEPENDS" ]; then
+ echo "ipkg_install_file: Warning: $pkg depends on the following uninstalled programs: $missing_deps"
+ else
+ echo "ipkg_install_file: ERROR: $pkg depends on the following uninstalled programs:
+ $missing_deps"
+ echo "ipkg_install_file: You may want to use \`ipkg install' to install these."
+ return 1
+ fi
+ fi
+
+ mkdir -p $IPKG_TMP/$pkg/control
+ mkdir -p $IPKG_TMP/$pkg/data
+ mkdir -p $info_dir
+
+ if ! $pkg_extract_stdout $filename ./control.tar.gz | (cd $IPKG_TMP/$pkg/control; tar -xzf - ) ; then
+ echo "ipkg_install_file: ERROR unpacking control.tar.gz from $filename"
+ return 1
+ fi
+
+ if [ -n "$IPKG_OFFLINE_ROOT" ]; then
+ if grep -q '^InstallsOffline:[[:space:]]*no' $IPKG_TMP/$pkg/control/control; then
+ echo "*** Warning: Package $pkg may not be installed in offline mode"
+ echo "*** Warning: Scheduling $filename for pending installation (installing into $IPKG_PENDING_DIR)"
+ echo "Package: $pkg
+Status: install ok pending" | ipkg_status_update_sd $sd $pkg
+ mkdir -p $IPKG_PENDING_DIR
+ cp -f $filename $IPKG_PENDING_DIR
+ rm -r $IPKG_TMP/$pkg/control
+ rm -r $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ return 0
+ fi
+ fi
+
+
+ echo -n "Unpacking $pkg..."
+ set +o noglob
+ for file in $IPKG_TMP/$pkg/control/*; do
+ local base_file="`ipkg_file_part $file`"
+ mv $file $info_dir/$pkg.$base_file
+ done
+ set -o noglob
+ rm -r $IPKG_TMP/$pkg/control
+
+ if ! $pkg_extract_stdout $filename ./data.tar.gz | (cd $IPKG_TMP/$pkg/data; tar -xzf - ) ; then
+ echo "ipkg_install_file: ERROR unpacking data.tar.gz from $filename"
+ return 1
+ fi
+ echo "Done."
+
+ echo -n "Configuring $pkg..."
+ export PKG_ROOT=$dest
+ if [ -x "$info_dir/$pkg.preinst" ]; then
+ if ! $info_dir/$pkg.preinst install; then
+ echo "$info_dir/$pkg.preinst failed. Aborting installation of $pkg"
+ rm -rf $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ return 1
+ fi
+ fi
+
+ local old_conffiles="`ipkg_status_sd $sd $pkg Conffiles | ipkg_extract_value`"
+ local new_conffiles=
+ if [ -f "$info_dir/$pkg.conffiles" ]; then
+ for conffile in `cat $info_dir/$pkg.conffiles`; do
+ if [ -f "$dest/$conffile" ] && ! echo " $old_conffiles " | grep -q " $conffile "`md5sum $dest/$conffile | sed 's/ .*//'`; then
+ local use_maintainers_conffile=
+ if [ -z "$FORCE_DEFAULTS" ]; then
+ while true; do
+ echo -n "Configuration file \`$conffile'
+ ==> File on system created by you or by a script.
+ ==> File also in package provided by package maintainer.
+ What would you like to do about it ? Your options are:
+ Y or I : install the package maintainer's version
+ N or O : keep your currently-installed version
+ D : show the differences between the versions (if diff is installed)
+ The default action is to keep your current version.
+*** `ipkg_file_part $conffile` (Y/I/N/O/D) [default=N] ? "
+ read response
+ case "$response" in
+ [YyIi] | [Yy][Ee][Ss])
+ use_maintainers_conffile=t
+ break
+ ;;
+ [Dd])
+ echo "
+diff -u $dest/$conffile $IPKG_TMP/$pkg/data/$conffile"
+ diff -u $dest/$conffile $IPKG_TMP/$pkg/data/$conffile || true
+ echo "[Press ENTER to continue]"
+ read junk
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+ fi
+ if [ -n "$use_maintainers_conffile" ]; then
+ local md5sum="`md5sum $IPKG_TMP/$pkg/data/$conffile | sed 's/ .*//'`"
+ new_conffiles="$new_conffiles $conffile $md5sum"
+ else
+ new_conffiles="$new_conffiles $conffile <custom>"
+ rm $IPKG_TMP/$pkg/data/$conffile
+ fi
+ else
+ md5sum="`md5sum $IPKG_TMP/$pkg/data/$conffile | sed 's/ .*//'`"
+ new_conffiles="$new_conffiles $conffile $md5sum"
+ fi
+ done
+ fi
+
+ local owd="`pwd`"
+ (cd $IPKG_TMP/$pkg/data/; tar cf - . | (cd $owd; cd $dest; tar xf -))
+ rm -rf $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ rm -f $info_dir/$pkg.list
+ $pkg_extract_stdout $filename ./data.tar.gz | tar tzf - | sed -e 's/^\.//' > $info_dir/$pkg.list
+
+ if [ -x "$info_dir/$pkg.postinst" ]; then
+ $info_dir/$pkg.postinst configure
+ fi
+
+ if [ -n "$new_conffiles" ]; then
+ new_conffiles='Conffiles: '`echo $new_conffiles | ipkg_protect_slashes`
+ fi
+ local sed_safe_offline_root="`echo ${IPKG_OFFLINE_ROOT} | ipkg_protect_slashes`"
+ local sed_safe_root="`echo $dest | sed -e "s/^${sed_safe_offline_root}//" | ipkg_protect_slashes`"
+ sed -e "s/\(Package:.*\)/\1\\
+Status: install ok installed\\
+Root: ${sed_safe_root}\\
+${new_conffiles}/" $info_dir/$pkg.control | ipkg_status_update_sd $sd $pkg
+
+ rm -f $info_dir/$pkg.control
+ rm -f $info_dir/$pkg.conffiles
+ rm -f $info_dir/$pkg.preinst
+ rm -f $info_dir/$pkg.postinst
+
+ echo "Done."
+}
+
+ipkg_install_file() {
+ ipkg_install_file_dest $IPKG_ROOT $*
+}
+
+ipkg_install() {
+
+ while [ $# -gt 0 ]; do
+ local pkg="$1"
+ shift
+
+ case "$pkg" in
+ http://* | ftp://*)
+ local tmp_pkg_file="$IPKG_TMP/"`ipkg_file_part $pkg`
+ if ipkg_download $pkg $tmp_pkg_file; then
+ ipkg_install_file $tmp_pkg_file
+ rm $tmp_pkg_file
+ fi
+ ;;
+ file:/*.ipk | file://*.deb)
+ local ipkg_filename="`echo $pkg|sed 's/^file://'`"
+ ipkg_install_file $ipkg_filename
+ ;;
+ *.ipk | *.deb)
+ ipkg_install_file $pkg
+ ;;
+ *)
+ ipkg_get_install $pkg || true
+ ;;
+ esac
+ done
+}
+
+ipkg_install_pending() {
+ [ -n "$IPKG_OFFLINE_ROOT" ] && return 0
+
+ if [ -d "$IPKG_PENDING_DIR" ]; then
+ set +o noglob
+ local pending="`ls -1d $IPKG_PENDING_DIR/*.ipk 2> /dev/null`" || true
+ set -o noglob
+ if [ -n "$pending" ]; then
+ echo "The following packages in $IPKG_PENDING_DIR will now be installed:"
+ echo $pending
+ for filename in $pending; do
+ if ipkg_install_file $filename; then
+ rm $filename
+ fi
+ done
+ fi
+ fi
+ return 0
+}
+
+ipkg_install_wanted() {
+ local wanted="`ipkg_status_matching 'Status:[[:space:]]*install.*not-installed'`"
+
+ if [ -n "$wanted" ]; then
+ echo "The following package were previously requested but have not been installed:"
+ echo $wanted
+
+ if [ -n "$FORCE_DEFAULTS" ]; then
+ echo "Installing them now."
+ else
+ echo -n "Install them now [Y/n] ? "
+ read response
+ case "$response" in
+ [Nn] | [Nn][Oo])
+ return 0
+ ;;
+ esac
+ fi
+
+ ipkg_install $wanted
+ fi
+
+ return 0
+}
+
+ipkg_upgrade_pkg() {
+ local pkg="$1"
+ local avail_ver="`ipkg_info $pkg Version | ipkg_extract_value | head -n 1`"
+
+ is_installed=
+ for dest_name in `ipkg_dest_names`; do
+ local dest="`ipkg_dest_byname $dest_name`"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local inst_ver="`ipkg_status_sd $sd $pkg Version | ipkg_extract_value`"
+ if [ -n "$inst_ver" ]; then
+ is_installed=t
+
+ if [ -z "$avail_ver" ]; then
+ echo "Assuming locally installed package $pkg ($inst_ver) is up to date"
+ return 0
+ fi
+
+ if [ "$avail_ver" = "$inst_ver" ]; then
+ echo "Package $pkg ($inst_ver) installed in $dest_name is up to date"
+ elif ipkg_is_upgrade "$avail_ver" "$inst_ver"; then
+ echo "Upgrading $pkg ($dest_name) from $inst_ver to $avail_ver"
+ ipkg_get_install_dest $dest $pkg
+ else
+ echo "Not downgrading package $pkg from $inst_ver to $avail_ver"
+ fi
+ fi
+ done
+
+ if [ -z "$is_installed" ]; then
+ echo "Package $pkg does not appear to be installed"
+ return 0
+ fi
+
+}
+
+ipkg_upgrade() {
+ if [ $# -lt 1 ]; then
+ local pkgs="`ipkg_status_matching 'Status:.*[[:space:]]installed'`"
+ else
+ pkgs="$*"
+ fi
+
+ for pkg in $pkgs; do
+ ipkg_upgrade_pkg $pkg
+ done
+}
+
+ipkg_remove_pkg_dest() {
+ local dest="$1"
+ local pkg="$2"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ if ! ipkg_status_installed_sd $sd $pkg; then
+ echo "ipkg_remove: Package $pkg does not appear to be installed in $dest"
+ if ipkg_status_mentioned_sd $sd $pkg; then
+ echo "Purging mention of $pkg from the ipkg database"
+ ipkg_status_remove_sd $sd $pkg
+ fi
+ return 1
+ fi
+
+ echo "ipkg_remove: Removing $pkg... "
+
+ local files="`cat $info_dir/$pkg.list`"
+
+ export PKG_ROOT=$dest
+ if [ -x "$info_dir/$pkg.prerm" ]; then
+ $info_dir/$pkg.prerm remove
+ fi
+
+ local conffiles="`ipkg_status_sd $sd $pkg Conffiles | ipkg_extract_value`"
+
+ local dirs_to_remove=
+ for file in $files; do
+ if [ -d "$dest/$file" ]; then
+ dirs_to_remove="$dirs_to_remove $dest/$file"
+ else
+ if echo " $conffiles " | grep -q " $file "; then
+ if echo " $conffiles " | grep -q " $file "`md5sum $dest/$file | sed 's/ .*//'`; then
+ rm -f $dest/$file
+ fi
+ else
+ rm -f $dest/$file
+ fi
+ fi
+ done
+
+ local removed_a_dir=t
+ while [ -n "$removed_a_dir" ]; do
+ removed_a_dir=
+ local new_dirs_to_remove=
+ for dir in $dirs_to_remove; do
+ if rmdir $dir >/dev/null 2>&1; then
+ removed_a_dir=t
+ else
+ new_dirs_to_remove="$new_dirs_to_remove $dir"
+ fi
+ done
+ dirs_to_remove="$new_dirs_to_remove"
+ done
+
+ if [ -n "$dirs_to_remove" ]; then
+ echo "ipkg_remove: Warning: Not removing the following directories since they are not empty:" >&2
+ echo "$dirs_to_remove" | sed -e 's/\/[/]\+/\//g' >&2
+ fi
+
+ if [ -x "$info_dir/$pkg.postrm" ]; then
+ $info_dir/$pkg.postrm remove
+ fi
+
+ ipkg_status_remove_sd $sd $pkg
+ set +o noglob
+ rm -f $info_dir/$pkg.*
+ set -o noglob
+
+ echo "Done."
+}
+
+ipkg_remove_pkg() {
+ local pkg="$1"
+ for dest in `ipkg_dests_all`; do
+ local sd=$dest/$IPKG_DIR_PREFIX
+ if ipkg_status_mentioned_sd $sd $pkg; then
+ ipkg_remove_pkg_dest $dest $pkg
+ fi
+ done
+}
+
+ipkg_remove() {
+ while [ $# -gt 0 ]; do
+ local pkg="$1"
+ shift
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_remove_pkg_dest $IPKG_ROOT $pkg
+ else
+ ipkg_remove_pkg $pkg
+ fi
+ done
+}
+
+###########
+# ipkg main
+###########
+
+# Parse options
+while [ $# -gt 0 ]; do
+ arg="$1"
+ case $arg in
+ -d | -dest)
+ [ $# -gt 1 ] || ipkg_usage "option $arg requires an argument"
+ DEST_NAME="$2"
+ shift
+ ;;
+ -o | -offline)
+ [ $# -gt 1 ] || ipkg_usage "option $arg requires an argument"
+ IPKG_OFFLINE_ROOT="$2"
+ shift
+ ;;
+ -force-depends)
+ FORCE_DEPENDS=t
+ ;;
+ -force-defaults)
+ FORCE_DEFAULTS=t
+ ;;
+ -*)
+ ipkg_usage "unknown option $arg"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+[ $# -lt 1 ] && ipkg_usage "ipkg must have one sub-command argument"
+cmd="$1"
+shift
+
+ipkg_load_configuration
+mkdir -p /tmp/ipkg
+
+case "$cmd" in
+update|upgrade|list|info|status|install_pending)
+ ;;
+install|depends|remove|files|search)
+ [ $# -lt 1 ] && ipkg_usage "ERROR: the \`\`$cmd'' command requires an argument"
+ ;;
+*)
+ echo "ERROR: unknown sub-command \`$cmd'"
+ ipkg_usage
+ ;;
+esac
+
+# Only install pending if we have an interactive sub-command
+case "$cmd" in
+upgrade|install)
+ ipkg_install_pending
+ ipkg_install_wanted
+ ;;
+esac
+
+ipkg_$cmd $*
+for a in `ls $IPKG_TMP`; do
+ rm -rf $IPKG_TMP/$a
+done
Property changes on: trunk/buildroot/scripts/ipkg
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/buildroot/scripts/make-ipkg-dir.sh
===================================================================
--- trunk/buildroot/scripts/make-ipkg-dir.sh (rev 0)
+++ trunk/buildroot/scripts/make-ipkg-dir.sh 2007-08-09 17:15:56 UTC (rev 619)
@@ -0,0 +1,21 @@
+#!/bin/bash
+BASE=http://armadeus.svn.sourceforge.net/viewvc/armadeus/trunk/
+TARGET=$1
+CONTROL=$2
+VERSION=$3
+ARCH=$4
+
+WD=$(pwd)
+
+mkdir -p "$TARGET/CONTROL"
+grep '^[^(Version|Architecture)]' "$CONTROL" > "$TARGET/CONTROL/control"
+grep '^Maintainer' "$CONTROL" 2>&1 >/dev/null || \
+ echo "Maintainer: Armadeus Project Developers Team <jul...@ar...>" >> "$TARGET/CONTROL/control"
+grep '^Source' "$CONTROL" 2>&1 >/dev/null || {
+ pkgbase=$(echo "$WD" | sed -e "s|^$TOPDIR/||g")
+ [ "$pkgbase" = "$WD" ] && src="N/A" || src="$BASE/$pkgbase"
+ echo "Source: $src" >> "$TARGET/CONTROL/control"
+}
+echo "Version: $VERSION" >> "$TARGET/CONTROL/control"
+echo "Architecture: $ARCH" >> "$TARGET/CONTROL/control"
+chmod 644 "$TARGET/CONTROL/control"
Property changes on: trunk/buildroot/scripts/make-ipkg-dir.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/buildroot/scripts/make-kmod-control.sh
===================================================================
--- trunk/buildroot/scripts/make-kmod-control.sh (rev 0)
+++ trunk/buildroot/scripts/make-kmod-control.sh 2007-08-09 17:15:56 UTC (rev 619)
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+#SCRIPT_DIR=`pwd`/scripts/ ./scripts/make-kmod-control.sh target/device/armadeus/linux/control/ build_arm_nofpu/linux-2.6.18.1/.config bin/packages/
+
+MODULE_PATH_PATTERN="Location="
+MODULE_CONFIG_PATTERN="Config="
+
+ARCH=arm
+
+debug()
+{
+ echo $1
+}
+
+print_usage()
+{
+ echo
+ echo " Usage: $0 control_files_dir linux_config package_building_dir"
+ echo
+ exit 0
+}
+
+CONTROL_DIR=$1
+PACKAGE_DIR=$3 # pass it $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)
+if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then
+ print_usage
+fi
+
+# sources linux .config file
+. "$2"
+CONTROL_FILES=`ls $CONTROL_DIR`
+mkdir -p PACKAGE_DIR
+
+cd "$CONTROL_DIR"
+TEMP_FILE="./temp.control"
+for File in $CONTROL_FILES; do
+ if [ -f "$File" ]; then
+ debug "--- Testing package Build for $File"
+ # Remove custom tag in corresponding .control file ../control/kmod-$(2).control
+ cat $File | grep -v $MODULE_PATH_PATTERN | grep -v $MODULE_CONFIG_PATTERN > $TEMP_FILE
+ # create linux-modules/ipkg install dirs (even if not needed)
+ $SCRIPT_DIR/make-ipkg-dir.sh $PACKAGE_DIR $TEMP_FILE 2.6.12-apf-2.2 $ARCH
+ #echo "Depends: $$(IDEPEND_$(1))" >> $$(I_$(1))/CONTROL/control
+ MODULE_PATH=`cat $File | grep $MODULE_PATH_PATTERN | cut -d = -f 2`
+ #debug $MODULE_PATH
+ CONFIG_FLAG=`grep $MODULE_CONFIG_PATTERN $File | cut -d = -f 2`
+ debug $CONFIG_FLAG
+ eval temp=\$$CONFIG_FLAG
+ if [ "$temp" == "m" ]; then
+ debug "packaging: $temp"
+ # Package should be built because driver was configured as a module
+ fi
+ fi
+done
+
+echo "CONFIG: $CONFIG_MODULE_UNLOAD"
+
+exit 0
\ No newline at end of file
Property changes on: trunk/buildroot/scripts/make-kmod-control.sh
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-09 17:14:11
|
Revision: 618
http://armadeus.svn.sourceforge.net/armadeus/?rev=618&view=rev
Author: artemys
Date: 2007-08-09 10:14:12 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[BUILDROOT] Add package generation of ipkg util
Modified Paths:
--------------
trunk/buildroot/package/ipkg/ipkg.mk
Added Paths:
-----------
trunk/buildroot/package/ipkg/ipkg/
trunk/buildroot/package/ipkg/ipkg/ipkg-sh.control
trunk/buildroot/package/ipkg/ipkg/ipkg.control
Added: trunk/buildroot/package/ipkg/ipkg/ipkg-sh.control
===================================================================
--- trunk/buildroot/package/ipkg/ipkg/ipkg-sh.control (rev 0)
+++ trunk/buildroot/package/ipkg/ipkg/ipkg-sh.control 2007-08-09 17:14:12 UTC (rev 618)
@@ -0,0 +1,16 @@
+Package: ipkg-sh
+Section: base
+Priority: required
+Essential: yes
+Description: lightweight package management system (shell version)
+ ipkg is the Itsy Package Management System, for handling
+ installation and removal of packages on a system. It can
+ recursively follow dependencies and download all packages
+ necessary to install a particular package.
+ .
+ ipkg knows how to install both .ipk and .deb packages.
+ .
+ ipkg is intended to serve the same functions (and more) for
+ Familiar that dpkg and apt serve for Debian, (while taking
+ up much less space).
+
Added: trunk/buildroot/package/ipkg/ipkg/ipkg.control
===================================================================
--- trunk/buildroot/package/ipkg/ipkg/ipkg.control (rev 0)
+++ trunk/buildroot/package/ipkg/ipkg/ipkg.control 2007-08-09 17:14:12 UTC (rev 618)
@@ -0,0 +1,16 @@
+Package: ipkg
+Section: base
+Priority: required
+Essential: yes
+Description: lightweight package management system
+ ipkg is the Itsy Package Management System, for handling
+ installation and removal of packages on a system. It can
+ recursively follow dependencies and download all packages
+ necessary to install a particular package.
+ .
+ ipkg knows how to install both .ipk and .deb packages.
+ .
+ ipkg is intended to serve the same functions (and more) for
+ Familiar that dpkg and apt serve for Debian, (while taking
+ up much less space).
+
Modified: trunk/buildroot/package/ipkg/ipkg.mk
===================================================================
--- trunk/buildroot/package/ipkg/ipkg.mk 2007-08-09 16:30:21 UTC (rev 617)
+++ trunk/buildroot/package/ipkg/ipkg.mk 2007-08-09 17:14:12 UTC (rev 618)
@@ -9,10 +9,11 @@
IPKG_RELEASE:=2
IPKG_MD5SUM:=975cc419d6db5fb279dc58177c68373b
-# IPKG_SOURCE_URL:=http://www.handhelds.org/packages/ipkg \
-# http://www.gtlib.gatech.edu/pub/handhelds.org/packages/ipkg \
-# http://ftp.gwdg.de/pub/linux/handhelds/packages/ipkg
IPKG_SITE:=http://ftp.gwdg.de/pub/linux/handhelds/packages/ipkg
+# Mirrors:
+# http://www.handhelds.org/packages/ipkg
+# http://www.gtlib.gatech.edu/pub/handhelds.org/packages/ipkg
+# http://ftp.gwdg.de/pub/linux/handhelds/packages/ipkg
IPKG_SOURCE:=$(IPKG_NAME)-$(IPKG_VERSION).tar.gz
IPKG_CAT:=zcat
@@ -34,7 +35,14 @@
toolchain/patch-kernel.sh $(IPKG_BUILD_DIR) package/ipkg/patches \*.patch
touch $@
-$(IPKG_BUILD_DIR)/.configured: $(IPKG_BUILD_DIR)/.patched
+$(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/CONTROL/control: $(IPKG_BUILD_DIR)/.patched
+ scripts/make-ipkg-dir.sh $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME) package/$(IPKG_NAME)/ipkg/$(IPKG_NAME).control $(IPKG_VERSION) arm
+ if [ "$$(IDEPEND_$(1))" != "" ]; then echo "Depends: $$(IDEPEND_$(1))" >> $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/CONTROL/control; fi
+ for file in conffiles preinst postinst prerm postrm; do \
+ [ -f ./ipkg/$(IPKG_NAME).$$$$file ] && cp ./ipkg/$(IPKG_NAME).$$$$file $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/CONTROL/$$$$file || true; \
+ done
+
+$(IPKG_BUILD_DIR)/.configured: $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/CONTROL/control
(cd $(IPKG_BUILD_DIR); rm -rf config.{cache,status} ; \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS)" \
@@ -72,12 +80,25 @@
all install
touch $@
+IPKG := IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(TARGET_DIR)/../ scripts/ipkg -force-defaults -force-depends
+# invoke ipkg-build with some default options
+TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
+IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
+# Define it where STAGING_DIR & Co is done -->>
+PACKAGE_DIR:= $(BUILD_DIR)/../bin/packages
+
ipkg-c: uclibc $(IPKG_BUILD_DIR)/.compiled
cp $(IPKG_INSTALL_DIR)/bin/ipkg-cl $(TARGET_DIR)/bin/ipkg
-$(STRIP) --strip-unneeded $(IPKG_INSTALL_DIR)/usr/lib/libipkg.so*
cp -P $(IPKG_INSTALL_DIR)/usr/lib/libipkg.so* $(TARGET_DIR)/usr/lib/
+ # ipkg stuff:
+ mkdir -p $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/bin
+ mkdir -p $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/usr/lib
+ cp $(TARGET_DIR)/bin/ipkg $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/bin/
+ cp -P $(IPKG_INSTALL_DIR)/usr/lib/libipkg.so* $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME)/usr/lib
+# $(IPKG) install bin/packages/$(IPKG_NAME)-$(IPKG_VERSION)-arm.ipk
# $(RSTRIP) $(IDIR_IPKG_C)
-# $(IPKG_BUILD) $(IDIR_IPKG_C) $(PACKAGE_DIR)
+ $(IPKG_BUILD) $(IPKG_BUILD_DIR)/ipkg/$(IPKG_NAME) $(PACKAGE_DIR)
ipkg-sh: uclibc
install -m0755 ./package/ipkg/files/ipkg $(TARGET_DIR)/bin/ipkg
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-09 16:30:21
|
Revision: 617
http://armadeus.svn.sourceforge.net/armadeus/?rev=617&view=rev
Author: artemys
Date: 2007-08-09 09:30:21 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
[BUILDROOT] Add ipkg-utils building for the Host
Added Paths:
-----------
trunk/buildroot/toolchain/ipkg-utils/
trunk/buildroot/toolchain/ipkg-utils/1.7/
trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_clean.patch
trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_tar.patch
trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_buildpackage.patch
trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_tar_wildcards.patch
trunk/buildroot/toolchain/ipkg-utils/ipkg-utils.mk
Added: trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_clean.patch
===================================================================
--- trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_clean.patch (rev 0)
+++ trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_clean.patch 2007-08-09 16:30:21 UTC (rev 617)
@@ -0,0 +1,36 @@
+diff -ruN ipkg-utils-1.7-old/ipkg-build ipkg-utils-1.7-new/ipkg-build
+--- ipkg-utils-1.7-old/ipkg-build 2004-08-24 04:56:12.000000000 +0200
++++ ipkg-utils-1.7-new/ipkg-build 2004-08-24 04:55:49.000000000 +0200
+@@ -47,6 +47,19 @@
+
+ PKG_ERROR=0
+
++ cvs_dirs=`find . -name 'CVS'`
++ if [ -n "$cvs_dirs" ]; then
++ if [ "$noclean" = "1" ]; then
++ echo "*** Warning: The following CVS directories where found.
++You probably want to remove them: " >&2
++ ls -ld $cvs_dirs
++ echo >&2
++ else
++ echo "*** Removing the following files: $cvs_dirs"
++ rm -rf "$cvs_dirs"
++ fi
++ fi
++
+ tilde_files=`find . -name '*~'`
+ if [ -n "$tilde_files" ]; then
+ if [ "$noclean" = "1" ]; then
+@@ -134,8 +147,12 @@
+
+ for script in $CONTROL/preinst $CONTROL/postinst $CONTROL/prerm $CONTROL/postrm; do
+ if [ -f $script -a ! -x $script ]; then
++ if [ "$noclean" = "1" ]; then
+ echo "*** Error: package script $script is not executable" >&2
+ PKG_ERROR=1
++ else
++ chmod a+x $script
++ fi
+ fi
+ done
+
Added: trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_tar.patch
===================================================================
--- trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_tar.patch (rev 0)
+++ trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_build_tar.patch 2007-08-09 16:30:21 UTC (rev 617)
@@ -0,0 +1,12 @@
+diff -ruN ipkg-utils-1.7-old/ipkg-build ipkg-utils-1.7-new/ipkg-build
+--- ipkg-utils-1.7-old/ipkg-build 2005-07-13 04:36:16.727438000 -0400
++++ ipkg-utils-1.7-new/ipkg-build 2005-07-13 05:27:49.385282832 -0400
+@@ -243,7 +243,7 @@
+ mkdir $tmp_dir
+
+ echo $CONTROL > $tmp_dir/tarX
+-( cd $pkg_dir && tar $ogargs -czf $tmp_dir/data.tar.gz . -X $tmp_dir/tarX )
++( cd $pkg_dir && tar $ogargs -X $tmp_dir/tarX -czf $tmp_dir/data.tar.gz . )
+ ( cd $pkg_dir/$CONTROL && tar $ogargs -czf $tmp_dir/control.tar.gz . )
+ rm $tmp_dir/tarX
+
Added: trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_buildpackage.patch
===================================================================
--- trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_buildpackage.patch (rev 0)
+++ trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_buildpackage.patch 2007-08-09 16:30:21 UTC (rev 617)
@@ -0,0 +1,24 @@
+diff -ruN ipkg-utils-1.7-old/ipkg-buildpackage ipkg-utils-1.7-new/ipkg-buildpackage
+--- ipkg-utils-1.7-old/ipkg-buildpackage 2001-07-26 17:36:36.000000000 +0200
++++ ipkg-utils-1.7-new/ipkg-buildpackage 2004-07-05 19:46:24.000000000 +0200
+@@ -30,8 +30,9 @@
+
+ set -e
+
+-#SCRIPTDIR=/usr/local/bin
+-SCRIPTDIR=/other/kurth/ipaq-dev/familiar/dist/ipkg/util/
++SCRIPTDIR=/usr/local/bin
++
++IPKG_BUILD_OPTIONS=$*
+
+ SCRIPTNAME=`basename $0`
+
+@@ -212,7 +213,7 @@
+ # build the ipk package
+ owd=`pwd`
+ cd ..
+-ipkg-build /tmp/${pkg} || exit 1
++ipkg-build $IPKG_BUILD_OPTIONS /tmp/${pkg} || exit 1
+
+ rm -rf /tmp/${pkg}
+
Added: trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_tar_wildcards.patch
===================================================================
--- trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_tar_wildcards.patch (rev 0)
+++ trunk/buildroot/toolchain/ipkg-utils/1.7/ipkg-utils-1.7-ipkg_tar_wildcards.patch 2007-08-09 16:30:21 UTC (rev 617)
@@ -0,0 +1,23 @@
+--- ipkg-utils-1.7/ipkg.py.orig 2006-06-29 14:16:00.000000000 +0200
++++ ipkg-utils-1.7/ipkg.py 2006-06-29 14:36:01.000000000 +0200
+@@ -93,9 +93,9 @@
+ self.filename = os.path.basename(fn)
+ ## sys.stderr.write(" extracting control.tar.gz from %s\n"% (fn,))
+ if self.isdeb:
+- control = os.popen("ar p "+fn+" control.tar.gz | tar xfzO - '*control'","r")
++ control = os.popen("ar p "+fn+" control.tar.gz | tar xzO --wildcards -f - '*control'","r")
+ else:
+- control = os.popen("tar xfzO "+fn+" '*control.tar.gz' | tar xfzO - '*control'","r")
++ control = os.popen("tar xzO --wildcards -f "+fn+" '*control.tar.gz' | tar xzO --wildcards -f - '*control'","r")
+ line = control.readline()
+ while 1:
+ if not line: break
+@@ -122,7 +122,7 @@
+ if self.isdeb:
+ data = os.popen("ar p "+fn+" data.tar.gz | tar tfz -","r")
+ else:
+- data = os.popen("tar xfzO "+fn+" '*data.tar.gz' | tar tfz -","r")
++ data = os.popen("tar xzO --wildcards -f "+fn+" '*data.tar.gz' | tar tfz -","r")
+ while 1:
+ line = data.readline()
+ if not line: break
Added: trunk/buildroot/toolchain/ipkg-utils/ipkg-utils.mk
===================================================================
--- trunk/buildroot/toolchain/ipkg-utils/ipkg-utils.mk (rev 0)
+++ trunk/buildroot/toolchain/ipkg-utils/ipkg-utils.mk 2007-08-09 16:30:21 UTC (rev 617)
@@ -0,0 +1,53 @@
+# ipkg-utils
+#
+# http://handhelds.org/packages/ipkg-utils
+#
+
+IPKG-UTILS_NAME := ipkg-utils
+IPKG-UTILS_VERSION := 1.7
+
+IPKG-UTILS_SOURCE_SITE := http://handhelds.org/packages/ipkg-utils/
+IPKG-UTILS_SOURCE_FILE := $(IPKG-UTILS_NAME)-$(IPKG-UTILS_VERSION).tar.gz
+IPKG-UTILS_SOURCE_CAT := $(ZCAT)
+IPKG-UTILS_SOURCE_DIR := $(IPKG-UTILS_NAME)-$(IPKG-UTILS_VERSION)
+
+IPKG-UTILS_BUILD_DIR := $(BUILD_DIR)/$(IPKG-UTILS_SOURCE_DIR)
+
+
+$(DL_DIR)/$(IPKG-UTILS_SOURCE_FILE):
+ $(WGET) -P $(DL_DIR) $(IPKG-UTILS_SOURCE_SITE)/$(IPKG-UTILS_SOURCE_FILE)
+
+$(IPKG-UTILS_BUILD_DIR)/.unpacked: $(DL_DIR)/$(IPKG-UTILS_SOURCE_FILE)
+ $(IPKG-UTILS_SOURCE_CAT) $(DL_DIR)/$(IPKG-UTILS_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(IPKG-UTILS_BUILD_DIR)/.patched: $(IPKG-UTILS_BUILD_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(IPKG-UTILS_BUILD_DIR) toolchain/$(IPKG-UTILS_NAME)/$(IPKG-UTILS_VERSION) \*.patch
+ touch $@
+
+$(STAGING_DIR)/usr/bin/ipkg-build: $(IPKG-UTILS_BUILD_DIR)/.patched
+ mkdir -p $(STAGING_DIR)/etc
+ echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf
+ echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf
+ mkdir -p $(STAGING_DIR)/usr/bin
+ install -m0755 $(IPKG-UTILS_BUILD_DIR)/ipkg-build $(STAGING_DIR)/usr/bin
+ install -m0755 $(IPKG-UTILS_BUILD_DIR)/ipkg-buildpackage $(STAGING_DIR)/usr/bin
+ install -m0755 $(IPKG-UTILS_BUILD_DIR)/ipkg-make-index $(STAGING_DIR)/usr/bin
+ install -m0755 $(IPKG-UTILS_BUILD_DIR)/ipkg.py $(STAGING_DIR)/usr/bin
+
+$(IPKG-UTILS_NAME)-source: $(DL_DIR)/$(IPKG-UTILS_SOURCE_FILE)
+
+$(IPKG-UTILS_NAME): $(STAGING_DIR)/usr/bin/ipkg-build
+
+$(IPKG-UTILS_NAME)-clean:
+ rm -f $(STAGING_DIR)/etc/ipkg.conf
+ rm -f $(STAGING_DIR)/usr/bin/ipkg*
+ rm -rf $(IPKG-UTILS_BUILD_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+TARGETS+=$(IPKG-UTILS_NAME)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-08 17:10:40
|
Revision: 616
http://armadeus.svn.sourceforge.net/armadeus/?rev=616&view=rev
Author: artemys
Date: 2007-08-08 10:10:41 -0700 (Wed, 08 Aug 2007)
Log Message:
-----------
[BUILDROOT] Add quick and dirty way to compile alsa-driver for APF9328
Added Paths:
-----------
trunk/buildroot/package/alsa-driver/
trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-add-tsc2102.patch
trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-rules.patch
trunk/buildroot/package/alsa-driver/alsa-driver.mk
trunk/buildroot/package/alsa-driver/imx-ssi_registers.h
trunk/buildroot/package/alsa-driver/imx-tsc2102.c
trunk/buildroot/package/alsa-driver/imx-tsc2102.h
trunk/buildroot/package/alsa-driver/imx1-ssi.c
trunk/buildroot/package/alsa-driver/imx1-ssi.h
trunk/buildroot/package/alsa-driver/imx1-ssi_types.h
Added: trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-add-tsc2102.patch
===================================================================
--- trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-add-tsc2102.patch (rev 0)
+++ trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-add-tsc2102.patch 2007-08-08 17:10:41 UTC (rev 616)
@@ -0,0 +1,282 @@
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/acinclude.m4 alsa-driver-1.0.14.mod/acinclude.m4
+--- alsa-driver-1.0.14/acinclude.m4 2007-06-04 09:28:55.000000000 +0200
++++ alsa-driver-1.0.14.mod/acinclude.m4 2007-08-06 20:08:44.000000000 +0200
+@@ -186,6 +186,7 @@
+ CONFIG_SND_AOA_SOUNDBUS_I2S=""
+ CONFIG_ARM=""
+ CONFIG_SND_SA11XX_UDA1341=""
++ CONFIG_SND_IMX_TSC2102=""
+ CONFIG_ARCH_SA1100=""
+ CONFIG_L3=""
+ CONFIG_SND_ARMAACI=""
+@@ -1962,6 +1963,18 @@
+ probed=0
+ fi
+ fi
++ if test "$card" = "all" -o "$card" = "imx-tsc"; then
++ if ( test "$CONFIG_SOUND" = "y" -o "$CONFIG_SOUND" = "m" ) &&
++ ( test "$CONFIG_ARM" = "y" -o "$CONFIG_ARM" = "m" ) &&
++ ( test "$CONFIG_ARCH_SA1100" = "y" -o "$CONFIG_ARCH_SA1100" = "m" ); then
++ CONFIG_SND_TIMER="m"
++ CONFIG_SND_PCM="m"
++ CONFIG_SND_IMX_TSC2102="m"
++ probed=1
++ elif test -z "$probed"; then
++ probed=0
++ fi
++ fi
+ if test "$card" = "all" -o "$card" = "armaaci"; then
+ if ( test "$CONFIG_SOUND" = "y" -o "$CONFIG_SOUND" = "m" ) &&
+ ( test "$CONFIG_ARM" = "y" -o "$CONFIG_ARM" = "m" ) &&
+@@ -2928,6 +2941,9 @@
+ if test -n "$CONFIG_SND_SA11XX_UDA1341"; then
+ AC_DEFINE(CONFIG_SND_SA11XX_UDA1341_MODULE)
+ fi
++if test -n "$CONFIG_SND_IMX_TSC2102"; then
++ AC_DEFINE(CONFIG_SND_IMX_TSC2102_MODULE)
++fi
+ if test -n "$CONFIG_SND_ARMAACI"; then
+ AC_DEFINE(CONFIG_SND_ARMAACI_MODULE)
+ fi
+@@ -3306,6 +3322,7 @@
+ AC_SUBST(CONFIG_SND_AOA_SOUNDBUS_I2S)
+ AC_SUBST(CONFIG_ARM)
+ AC_SUBST(CONFIG_SND_SA11XX_UDA1341)
++AC_SUBST(CONFIG_SND_IMX_TSC2102)
+ AC_SUBST(CONFIG_ARCH_SA1100)
+ AC_SUBST(CONFIG_L3)
+ AC_SUBST(CONFIG_SND_ARMAACI)
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/alsa-kernel/arm/Kconfig alsa-driver-1.0.14.mod/alsa-kernel/arm/Kconfig
+--- alsa-driver-1.0.14/alsa-kernel/arm/Kconfig 2007-06-04 09:28:52.000000000 +0200
++++ alsa-driver-1.0.14.mod/alsa-kernel/arm/Kconfig 2007-08-07 11:56:04.000000000 +0200
+@@ -33,4 +33,11 @@
+ Say Y or M if you want to support any AC97 codec attached to
+ the PXA2xx AC97 interface.
+
++config SND_IMX_TSC2102
++ tristate "TSC2102 driver for the i.MXL"
++ depends on ARCH_IMX && SND
++ help
++ Say Y or M if you want to support TSC2102 codec attached to
++ the i.MXL SSI interface.
++
+ endmenu
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/alsa-kernel/arm/Makefile alsa-driver-1.0.14.mod/alsa-kernel/arm/Makefile
+--- alsa-driver-1.0.14/alsa-kernel/arm/Makefile 2007-06-04 09:28:52.000000000 +0200
++++ alsa-driver-1.0.14.mod/alsa-kernel/arm/Makefile 2007-08-08 11:39:22.000000000 +0200
+@@ -12,4 +12,12 @@
+ snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
+
+ obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
++#obj-m += snd-pxa2xx-ac97.o
+ snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
++
++#obj-$(CONFIG_SND_IMX_TSC2102) += snd-imx-tsc.o
++obj-m += snd-imx-tsc.o
++snd-imx-tsc-objs := imx-tsc2102.o
++
++obj-m += snd-imx1-ssi.o
++snd-imx1-ssi-objs := imx1-ssi.o
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/alsa-kernel/Kconfig alsa-driver-1.0.14.mod/alsa-kernel/Kconfig
+--- alsa-driver-1.0.14/alsa-kernel/Kconfig 2007-06-04 09:28:52.000000000 +0200
++++ alsa-driver-1.0.14.mod/alsa-kernel/Kconfig 2007-08-07 11:53:32.000000000 +0200
+@@ -32,7 +32,7 @@
+ Kernel patches and supporting utilities to do that are in the pcsp
+ package, available at <ftp://ftp.infradead.org/pub/pcsp/>.
+
+-source "sound/oss/dmasound/Kconfig"
++#source "sound/oss/dmasound/Kconfig"
+
+ if !M68K
+
+@@ -91,7 +91,7 @@
+ help
+ Say 'Y' or 'M' to enable Open Sound System drivers.
+
+-source "sound/oss/Kconfig"
++#source "sound/oss/Kconfig"
+
+ endmenu
+
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/alsa-kernel/Makefile alsa-driver-1.0.14.mod/alsa-kernel/Makefile
+--- alsa-driver-1.0.14/alsa-kernel/Makefile 2007-06-04 09:28:52.000000000 +0200
++++ alsa-driver-1.0.14.mod/alsa-kernel/Makefile 2007-08-07 12:03:05.000000000 +0200
+@@ -5,7 +5,8 @@
+ obj-$(CONFIG_SOUND_PRIME) += sound_firmware.o
+ obj-$(CONFIG_SOUND_PRIME) += oss/
+ obj-$(CONFIG_DMASOUND) += oss/
+-obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ soc/
++#obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ soc/
++obj-y += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ soc/
+ obj-$(CONFIG_SND_AOA) += aoa/
+
+ # This one must be compilable even if sound is configured out
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/arm/imx1-ssi.c alsa-driver-1.0.14.mod/arm/imx1-ssi.c
+--- alsa-driver-1.0.14/arm/imx1-ssi.c 1970-01-01 01:00:00.000000000 +0100
++++ alsa-driver-1.0.14.mod/arm/imx1-ssi.c 2007-08-07 10:40:54.000000000 +0200
+@@ -0,0 +1,2 @@
++#include "../alsa-kernel/arm/imx1-ssi.c"
++EXPORT_NO_SYMBOLS;
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/arm/imx-tsc2102.c alsa-driver-1.0.14.mod/arm/imx-tsc2102.c
+--- alsa-driver-1.0.14/arm/imx-tsc2102.c 1970-01-01 01:00:00.000000000 +0100
++++ alsa-driver-1.0.14.mod/arm/imx-tsc2102.c 2007-08-07 10:41:25.000000000 +0200
+@@ -0,0 +1,2 @@
++#include "../alsa-kernel/arm/imx-tsc2102.c"
++EXPORT_NO_SYMBOLS;
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/configure alsa-driver-1.0.14.mod/configure
+--- alsa-driver-1.0.14/configure 2007-06-04 09:29:01.000000000 +0200
++++ alsa-driver-1.0.14.mod/configure 2007-08-06 20:11:32.000000000 +0200
+@@ -836,6 +836,7 @@
+ CONFIG_SND_AOA_SOUNDBUS
+ CONFIG_SND_AOA_SOUNDBUS_I2S
+ CONFIG_SND_SA11XX_UDA1341
++CONFIG_SND_IMX_TSC2102
+ CONFIG_SND_ARMAACI
+ CONFIG_ARM_AMBA
+ CONFIG_SND_PXA2XX_PCM
+@@ -4356,6 +4357,7 @@
+ CONFIG_SND_AOA_SOUNDBUS_I2S=""
+ CONFIG_ARM=""
+ CONFIG_SND_SA11XX_UDA1341=""
++ CONFIG_SND_IMX_TSC2102=""
+ CONFIG_ARCH_SA1100=""
+ CONFIG_L3=""
+ CONFIG_SND_ARMAACI=""
+@@ -7343,6 +7345,7 @@
+ CONFIG_ARM=
+ CONFIG_ARCH_SA1100=
+ CONFIG_ARCH_PXA=
++CONFIG_ARCH_IMX=
+ CONFIG_PPC=
+ CONFIG_SPARC32=
+ CONFIG_SPARC64=
+@@ -7360,8 +7363,8 @@
+ KERNDIR=$CONFIG_SND_KERNELDIR
+ fi
+ if test "$cross_compiling" = yes; then
+- { echo "$as_me:$LINENO: result: unknown" >&5
+-echo "${ECHO_T}unknown" >&6; };processor=""
++ { echo "$as_me:$LINENO: result: imx" >&5
++echo "${ECHO_T}unknown" >&6; };processor="imx"
+
+ else
+ cat >conftest.$ac_ext <<_ACEOF
+@@ -7447,6 +7450,8 @@
+ fprintf(file, "sa1100");
+ #elif defined(CONFIG_ARCH_PXA)
+ fprintf(file, "pxa");
++#elif defined(CONFIG_ARCH_IMX)
++ fprintf(file, "imx");
+ #elif defined(CONFIG_ARM_AMBA)
+ fprintf(file, "amba");
+ #elif defined(CONFIG_PARISC)
+@@ -7502,7 +7507,6 @@
+
+
+ CFLAGS="$ac_save_CFLAGS"
+-rm -f processor.id
+ c_opts=""
+ KLD=ld
+ ARCH=
+@@ -7734,6 +7738,14 @@
+ CONFIG_ARCH_PXA=y
+ test "$CONFIG_ISA" = "probe" && CONFIG_ISA=
+ ;;
++ imx)
++ ARCH=arm
++ c_opts="-O2 -mapcs-32 -march=armv4 -msoft-float"
++ CONFIG_ARM=y
++ # CONFIG_L3=y
++ CONFIG_ARCH_IMX=y
++ test "$CONFIG_ISA" = "probe" && CONFIG_ISA=
++ ;;
+ amba)
+ ARCH=arm
+ c_opts="-O2 -mapcs-32 -march=armv4 -Wa,-mxscale -mshort-load-bytes -msoft-float"
+@@ -14464,6 +14476,18 @@
+ probed=0
+ fi
+ fi
++ if test "$card" = "all" -o "$card" = "imx-tsc"; then
++ if ( test "$CONFIG_SOUND" = "y" -o "$CONFIG_SOUND" = "m" ) &&
++ ( test "$CONFIG_ARM" = "y" -o "$CONFIG_ARM" = "m" ) &&
++ ( test "$CONFIG_ARCH_IMX" = "y" -o "$CONFIG_ARCH_IMX" = "m" ); then
++ CONFIG_SND_TIMER="m"
++ CONFIG_SND_PCM="m"
++ CONFIG_SND_IMX_TSC2102="m"
++ probed=1
++ elif test -z "$probed"; then
++ probed=0
++ fi
++ fi
+ if test "$card" = "all" -o "$card" = "armaaci"; then
+ if ( test "$CONFIG_SOUND" = "y" -o "$CONFIG_SOUND" = "m" ) &&
+ ( test "$CONFIG_ARM" = "y" -o "$CONFIG_ARM" = "m" ) &&
+@@ -15889,6 +15913,12 @@
+ _ACEOF
+
+ fi
++if test -n "$CONFIG_SND_IMX_TSC2102"; then
++ cat >>confdefs.h <<\_ACEOF
++#define CONFIG_SND_IMX_TSC2102_MODULE 1
++_ACEOF
++
++fi
+ if test -n "$CONFIG_SND_ARMAACI"; then
+ cat >>confdefs.h <<\_ACEOF
+ #define CONFIG_SND_ARMAACI_MODULE 1
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/configure.in alsa-driver-1.0.14.mod/configure.in
+--- alsa-driver-1.0.14/configure.in 2007-06-04 09:28:51.000000000 +0200
++++ alsa-driver-1.0.14.mod/configure.in 2007-08-06 19:22:43.000000000 +0200
+@@ -918,6 +918,8 @@
+ fprintf(file, "sa1100");
+ #elif defined(CONFIG_ARCH_PXA)
+ fprintf(file, "pxa");
++#elif defined(CONFIG_ARCH_IMX)
++ fprintf(file, "imx");
+ #elif defined(CONFIG_ARM_AMBA)
+ fprintf(file, "amba");
+ #elif defined(CONFIG_PARISC)
+@@ -941,7 +943,6 @@
+ AC_MSG_RESULT(unknown);processor=""
+ )
+ CFLAGS="$ac_save_CFLAGS"
+-rm -f processor.id
+ c_opts=""
+ KLD=ld
+ ARCH=
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/toplevel.config alsa-driver-1.0.14.mod/toplevel.config
+--- alsa-driver-1.0.14/toplevel.config 2007-08-08 18:33:37.000000000 +0200
++++ alsa-driver-1.0.14.mod/toplevel.config 2007-08-07 12:52:01.000000000 +0200
+@@ -182,8 +182,10 @@
+ CONFIG_SND_AOA_TOONIE=
+ CONFIG_SND_AOA_SOUNDBUS=
+ CONFIG_SND_AOA_SOUNDBUS_I2S=
+-CONFIG_ARM=
++CONFIG_ARM=y
++CONFIG_MACH_APF9328=y
+ CONFIG_SND_SA11XX_UDA1341=
++CONFIG_SND_IMX_TSC2102=m
+ CONFIG_ARCH_SA1100=
+ CONFIG_L3=
+ CONFIG_SND_ARMAACI=
+@@ -191,6 +193,7 @@
+ CONFIG_SND_PXA2XX_PCM=
+ CONFIG_SND_PXA2XX_AC97=
+ CONFIG_ARCH_PXA=
++CONFIG_ARCH_IMX=y
+ CONFIG_SND_S3C2410=
+ CONFIG_ARCH_S3C2410=
+ CONFIG_I2C_SENSOR=
+diff -urN -X linux-2.6.18.1/Documentation/dontdiff alsa-driver-1.0.14/toplevel.config.in alsa-driver-1.0.14.mod/toplevel.config.in
+--- alsa-driver-1.0.14/toplevel.config.in 2007-06-04 09:28:55.000000000 +0200
++++ alsa-driver-1.0.14.mod/toplevel.config.in 2007-08-06 20:02:26.000000000 +0200
+@@ -184,6 +184,7 @@
+ CONFIG_SND_AOA_SOUNDBUS_I2S=@CONFIG_SND_AOA_SOUNDBUS_I2S@
+ CONFIG_ARM=@CONFIG_ARM@
+ CONFIG_SND_SA11XX_UDA1341=@CONFIG_SND_SA11XX_UDA1341@
++CONFIG_SND_IMX_TSC2102=@CONFIG_SND_IMX_TSC2102@
+ CONFIG_ARCH_SA1100=@CONFIG_ARCH_SA1100@
+ CONFIG_L3=@CONFIG_L3@
+ CONFIG_SND_ARMAACI=@CONFIG_SND_ARMAACI@
+Binary files alsa-driver-1.0.14/utils/mod-deps and alsa-driver-1.0.14.mod/utils/mod-deps differ
Added: trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-rules.patch
===================================================================
--- trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-rules.patch (rev 0)
+++ trunk/buildroot/package/alsa-driver/alsa-driver-armadeus-rules.patch 2007-08-08 17:10:41 UTC (rev 616)
@@ -0,0 +1,11 @@
+--- alsa-driver-1.0.14/Rules.make 2007-06-04 09:28:51.000000000 +0200
++++ alsa-driver-1.0.14.working/Rules.make 2007-08-01 12:47:03.000000000 +0200
+@@ -158,7 +158,7 @@
+
+ $(ld-multi-used-m) : %.o: $(ld-multi-objs-m)
+ rm -f $@
+- $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs) $(extra-$(basename $@)-objs), $^)
++ arm-linux-ld $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs) $(extra-$(basename $@)-objs), $^)
+
+ #
+ # This make dependencies quickly
Added: trunk/buildroot/package/alsa-driver/alsa-driver.mk
===================================================================
--- trunk/buildroot/package/alsa-driver/alsa-driver.mk (rev 0)
+++ trunk/buildroot/package/alsa-driver/alsa-driver.mk 2007-08-08 17:10:41 UTC (rev 616)
@@ -0,0 +1,83 @@
+#############################################################
+#
+# alsa-driver
+#
+#############################################################
+ALSA_DRIVER_VERSION:=1.0.14
+ALSA_DRIVER_SOURCE:=alsa-driver-$(ALSA_DRIVER_VERSION).tar.bz2
+ALSA_DRIVER_SITE:=ftp://ftp.alsa-project.org/pub/driver
+ALSA_DRIVER_DIR:=$(BUILD_DIR)/alsa-driver-$(ALSA_DRIVER_VERSION)
+ALSA_DRIVER_CAT:=bzcat
+ALSA_DRIVER_BINARY:=libasound.so.2.0.0
+ALSA_DRIVER_TARGET_BINARY:=usr/lib/$(ALSA_DRIVER_BINARY)
+
+$(DL_DIR)/$(ALSA_DRIVER_SOURCE):
+ $(WGET) -P $(DL_DIR) $(ALSA_DRIVER_SITE)/$(ALSA_DRIVER_SOURCE)
+
+$(ALSA_DRIVER_DIR)/.unpacked: $(DL_DIR)/$(ALSA_DRIVER_SOURCE)
+ $(ALSA_DRIVER_CAT) $(DL_DIR)/$(ALSA_DRIVER_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ toolchain/patch-kernel.sh $(ALSA_DRIVER_DIR) package/alsa-driver/ alsa-driver-$(ALSA_DRIVER_VERSION)\*.patch*
+ toolchain/patch-kernel.sh $(ALSA_DRIVER_DIR) package/alsa-driver/ alsa-driver-armadeus\*.patch
+ # Copy our custom drivers (until they are integrated in alsa mainline)
+ cp -f package/alsa-driver/imx* $(ALSA_DRIVER_DIR)/alsa-kernel/arm/
+# $(CONFIG_UPDATE) $(ALSA_DRIVER_DIR)
+ touch $@
+
+$(ALSA_DRIVER_DIR)/.configured: $(ALSA_DRIVER_DIR)/.unpacked
+ (cd $(ALSA_DRIVER_DIR); rm -rf config.cache; \
+ $(TARGET_CONFIGURE_ARGS) \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)" \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --disable-docs \
+ --with-sequencer=yes \
+ --with-isapnp=no \
+ --with-oss=yes \
+ --with-kernel=${BUILD_DIR}/linux-2.6.18.1 \
+ --with-kernel-version=2.6.18.1 \
+ --with-cards=all \
+ );
+ touch $@
+
+$(ALSA_DRIVER_DIR)/modules/snd-imx-tsc.o: $(ALSA_DRIVER_DIR)/.configured
+ (export PATH=${PATH}:${STAGING_DIR}/bin ; \
+ $(MAKE) -C $(ALSA_DRIVER_DIR) \
+ );
+
+# $(STAGING_DIR)/$(ALSA_DRIVER_TARGET_BINARY): $(ALSA_DRIVER_DIR)/src/.libs/$(ALSA_DRIVER_BINARY)
+# $(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_DRIVER_DIR) install
+# $(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/usr/lib\',g" $(STAGING_DIR)/usr/lib/libasound.la
+#
+# $(TARGET_DIR)/$(ALSA_DRIVER_TARGET_BINARY): $(STAGING_DIR)/$(ALSA_DRIVER_TARGET_BINARY)
+# mkdir -p $(TARGET_DIR)/usr/share/alsa
+# mkdir -p $(TARGET_DIR)/usr/lib/alsa-lib
+# cp -dpf $(STAGING_DIR)/lib/libasound.so* $(TARGET_DIR)/usr/lib/
+# cp -rdpf $(STAGING_DIR)/usr/share/alsa/* $(TARGET_DIR)/usr/share/alsa/
+# cp -rdpf $(STAGING_DIR)/usr/lib/alsa-lib/* $(TARGET_DIR)/usr/lib/alsa-lib/
+# -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libasound.so*
+# -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/alsa-lib/*.so
+# touch -c $@
+
+alsa-driver: uclibc linux $(ALSA_DRIVER_DIR)/modules/snd-imx-tsc.o
+
+alsa-driver-clean:
+ rm -f $(TARGET_DIR)/$(ALSA_DRIVER_TARGET_BINARY)
+ -$(MAKE) -C $(ALSA_DRIVER_DIR) clean
+
+alsa-driver-dirclean:
+ rm -rf $(ALSA_DRIVER_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_ALSA_DRIVER)),y)
+TARGETS+=alsa-driver
+endif
\ No newline at end of file
Added: trunk/buildroot/package/alsa-driver/imx-ssi_registers.h
===================================================================
--- trunk/buildroot/package/alsa-driver/imx-ssi_registers.h (rev 0)
+++ trunk/buildroot/package/alsa-driver/imx-ssi_registers.h 2007-08-08 17:10:41 UTC (rev 616)
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
+*/
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+*/
+
+ /*!
+ * @file ../ssi/registers.h
+ * @brief This header file contains SSI driver low level definition to access module registers.
+ *
+ * @ingroup SSI
+ */
+
+#ifndef __MXC_SSI_REGISTERS_H__
+#define __MXC_SSI_REGISTERS_H__
+
+/*!
+ * This include to define bool type, false and true definitions.
+ */
+#include <asm/hardware.h>
+
+#define SPBA_CPU_SSI 0x07
+
+#define MXC_SSISTX0 0x00
+#define MXC_SSISTX1 0x04
+#define MXC_SSISRX0 0x08
+#define MXC_SSISRX1 0x0C
+#define MXC_SSISCR 0x10
+#define MXC_SSISISR 0x14
+#define MXC_SSISIER 0x18
+#define MXC_SSISTCR 0x1C
+#define MXC_SSISRCR 0x20
+#define MXC_SSISTCCR 0x24
+#define MXC_SSISRCCR 0x28
+#define MXC_SSISFCSR 0x2C
+#define MXC_SSISTR 0x30
+#define MXC_SSISOR 0x34
+#define MXC_SSISACNT 0x38
+#define MXC_SSISACADD 0x3C
+#define MXC_SSISACDAT 0x40
+#define MXC_SSISATAG 0x44
+#define MXC_SSISTMSK 0x48
+#define MXC_SSISRMSK 0x4C
+
+/*! SSI1 registers offset*/
+#define MXC_SSI1STX0 0x00
+#define MXC_SSI1STX1 0x04
+#define MXC_SSI1SRX0 0x08
+#define MXC_SSI1SRX1 0x0C
+#define MXC_SSI1SCR 0x10
+#define MXC_SSI1SISR 0x14
+#define MXC_SSI1SIER 0x18
+#define MXC_SSI1STCR 0x1C
+#define MXC_SSI1SRCR 0x20
+#define MXC_SSI1STCCR 0x24
+#define MXC_SSI1SRCCR 0x28
+#define MXC_SSI1SFCSR 0x2C
+#define MXC_SSI1STR 0x30
+#define MXC_SSI1SOR 0x34
+#define MXC_SSI1SACNT 0x38
+#define MXC_SSI1SACADD 0x3C
+#define MXC_SSI1SACDAT 0x40
+#define MXC_SSI1SATAG 0x44
+#define MXC_SSI1STMSK 0x48
+#define MXC_SSI1SRMSK 0x4C
+
+/*! SSI2 registers offset*/
+#define MXC_SSI2STX0 0x00
+#define MXC_SSI2STX1 0x04
+#define MXC_SSI2SRX0 0x08
+#define MXC_SSI2SRX1 0x0C
+#define MXC_SSI2SCR 0x10
+#define MXC_SSI2SISR 0x14
+#define MXC_SSI2SIER 0x18
+#define MXC_SSI2STCR 0x1C
+#define MXC_SSI2SRCR 0x20
+#define MXC_SSI2STCCR 0x24
+#define MXC_SSI2SRCCR 0x28
+#define MXC_SSI2SFCSR 0x2C
+#define MXC_SSI2STR 0x30
+#define MXC_SSI2SOR 0x34
+#define MXC_SSI2SACNT 0x38
+#define MXC_SSI2SACADD 0x3C
+#define MXC_SSI2SACDAT 0x40
+#define MXC_SSI2SATAG 0x44
+#define MXC_SSI2STMSK 0x48
+#define MXC_SSI2SRMSK 0x4C
+
+/*!
+ * SCR Register bit shift definitions
+ */
+#define SSI_ENABLE_SHIFT 0
+#define SSI_TRANSMIT_ENABLE_SHIFT 1
+#define SSI_RECEIVE_ENABLE_SHIFT 2
+#define SSI_NETWORK_MODE_SHIFT 3
+#define SSI_SYNCHRONOUS_MODE_SHIFT 4
+#define SSI_I2S_MODE_SHIFT 5
+#define SSI_SYSTEM_CLOCK_SHIFT 7
+#define SSI_TWO_CHANNEL_SHIFT 8
+#define SSI_CLOCK_IDLE_SHIFT 9
+
+/*!
+ * STCR & SRCR Registers bit shift definitions
+ */
+#define SSI_EARLY_FRAME_SYNC_SHIFT 0
+#define SSI_FRAME_SYNC_LENGTH_SHIFT 1
+#define SSI_FRAME_SYNC_INVERT_SHIFT 2
+#define SSI_CLOCK_POLARITY_SHIFT 3
+#define SSI_SHIFT_DIRECTION_SHIFT 4
+#define SSI_CLOCK_DIRECTION_SHIFT 5
+#define SSI_FRAME_DIRECTION_SHIFT 6
+#define SSI_FIFO_ENABLE_0_SHIFT 7
+#define SSI_FIFO_ENABLE_1_SHIFT 8
+#define SSI_BIT_0_SHIFT 9
+// For Armadeus i.MXL
+#define SSI_FIFO_ENABLE_SHIFT 7
+
+/*!
+ * STCCR & SRCCR Registers bit shift definitions
+ */
+#define SSI_PRESCALER_MODULUS_SHIFT 0
+#define SSI_FRAME_RATE_DIVIDER_SHIFT 8
+#define SSI_WORD_LENGTH_SHIFT 13
+#define SSI_PRESCALER_RANGE_SHIFT 17
+#define SSI_DIVIDE_BY_TWO_SHIFT 18
+#define SSI_FRAME_DIVIDER_MASK 31
+#define SSI_MIN_FRAME_DIVIDER_RATIO 1
+#define SSI_MAX_FRAME_DIVIDER_RATIO 32
+#define SSI_PRESCALER_MODULUS_MASK 255
+#define SSI_MIN_PRESCALER_MODULUS_RATIO 1
+#define SSI_MAX_PRESCALER_MODULUS_RATIO 256
+#define SSI_WORD_LENGTH_MASK 15
+/*!
+ * SISR Register definition
+ */
+#define SSI_IRQ_STATUS_NUMBER 19
+
+/*!
+ * SFCSR Register bit shift definitions
+ */
+#define SSI_RX_FIFO_1_COUNT_SHIFT 28
+#define SSI_TX_FIFO_1_COUNT_SHIFT 24
+#define SSI_RX_FIFO_1_WATERMARK_SHIFT 20
+#define SSI_TX_FIFO_1_WATERMARK_SHIFT 16
+#define SSI_RX_FIFO_0_COUNT_SHIFT 12
+#define SSI_TX_FIFO_0_COUNT_SHIFT 8
+#define SSI_RX_FIFO_0_WATERMARK_SHIFT 4
+#define SSI_TX_FIFO_0_WATERMARK_SHIFT 0
+#define SSI_MIN_FIFO_WATERMARK 0
+#define SSI_MAX_FIFO_WATERMARK 8
+// For Armadeus i.MXL:
+#define SSI_RX_FIFO_COUNT_SHIFT 28
+#define SSI_TX_FIFO_COUNT_SHIFT 24
+#define SSI_RX_FIFO_WATERMARK_SHIFT 20
+#define SSI_TX_FIFO_WATERMARK_SHIFT 16
+
+
+/*!
+ * SSI Option Register (SOR) bit shift definitions
+ */
+#define SSI_FRAME_SYN_RESET_SHIFT 0
+#define SSI_WAIT_SHIFT 1
+#define SSI_INIT_SHIFT 3
+#define SSI_TRANSMITTER_CLEAR_SHIFT 4
+#define SSI_RECEIVER_CLEAR_SHIFT 5
+#define SSI_CLOCK_OFF_SHIFT 6
+#define SSI_WAIT_STATE_MASK 0x3
+
+/*!
+ * SSI AC97 Control Register (SACNT) bit shift definitions
+ */
+#define AC97_MODE_ENABLE_SHIFT 0
+#define AC97_VARIABLE_OPERATION_SHIFT 1
+#define AC97_TAG_IN_FIFO_SHIFT 2
+#define AC97_READ_COMMAND_SHIFT 3
+#define AC97_WRITE_COMMAND_SHIFT 4
+#define AC97_FRAME_RATE_DIVIDER_SHIFT 5
+#define AC97_FRAME_RATE_MASK 0x3F
+
+/*!
+ * SSI Test Register (STR) bit shift definitions
+ */
+#define SSI_TEST_MODE_SHIFT 15
+#define SSI_RCK2TCK_SHIFT 14
+#define SSI_RFS2TFS_SHIFT 13
+#define SSI_RXSTATE_SHIFT 8
+#define SSI_TXD2RXD_SHIFT 7
+#define SSI_TCK2RCK_SHIFT 6
+#define SSI_TFS2RFS_SHIFT 5
+#define SSI_TXSTATE_SHIFT 0
+
+#endif /* __MXC_SSI_REGISTERS_H__ */
+
Added: trunk/buildroot/package/alsa-driver/imx-tsc2102.c
===================================================================
--- trunk/buildroot/package/alsa-driver/imx-tsc2102.c (rev 0)
+++ trunk/buildroot/package/alsa-driver/imx-tsc2102.c 2007-08-08 17:10:41 UTC (rev 616)
@@ -0,0 +1,3131 @@
+/*
+ * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+ /*!
+ * @defgroup SOUND_DRV MXC Sound Driver for ALSA
+ */
+
+ /*!
+ * @file mxc-alsa-pmic.c
+ * @brief this fle mxc-alsa-pmic.c
+ * @brief this file implements the mxc sound driver interface for ALSA.
+ * The mxc sound driver supports mono/stereo recording (there are
+ * some limitations due to hardware), mono/stereo playback and
+ * audio mixing.
+ * Recording supports 8000 khz and 16000 khz sample rate.
+ * Playback supports 8000, 11025, 16000, 22050, 24000, 32000,
+ * 44100, 48000 Hz for mono and stereo.
+ * This file also handles the software mixer and abstraction APIs
+ * that control the volume,balance,mono-adder,input and output
+ * devices for PMIC.
+ * These mixer controls shall be accessible thru alsa as well as
+ * OSS emulation modes
+ *
+ * @ingroup SOUND_DRV
+ */
+#define DEBUG
+
+#include <sound/driver.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/ioctl.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/dma-mapping.h>
+#include <linux/soundcard.h>
+
+#ifdef CONFIG_PM
+#include <linux/pm.h>
+#endif /* CONFIG_PM */
+
+#include <asm/arch/dma.h>
+/*#include <asm/arch/spba.h>
+#include <asm/arch/clock.h>
+*/
+#include <asm/mach-types.h>
+
+/*#include <ssi/ssi.h>
+#include <ssi/registers.h>
+#include <dam/dam.h>
+#include <asm/arch/pmic_external.h>
+#include <asm/arch/pmic_audio.h>
+*/
+#include "imx-ssi_registers.h"
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/initval.h>
+#include <sound/control.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/imx-dma.h>
+#include "imx1-ssi.h"
+/*#include "mxc-alsa-pmic.h"
+#include "mxc-alsa-common.h"
+*/
+#include <linux/fs.h>
+/*
+ * PMIC driver buffer policy.
+ * Customize here if the sound is not correct
+ */
+#define MAX_BUFFER_SIZE 16384
+#define DMA_BUF_SIZE 8192
+#define MIN_PERIOD_SIZE 64
+#define MIN_PERIOD 2
+#define MAX_PERIOD 255
+
+#define AUD_MUX_CONF 0x0031010
+#define MASK_2_TS 0xfffffffc
+#define MASK_1_TS 0xfffffffe
+#define SOUND_CARD_NAME "MXC"
+
+/*!
+ * These defines enable DMA chaining for playback
+ * and capture respectively.
+ */
+#define MXC_SOUND_PLAYBACK_CHAIN_DMA_EN 1
+#define MXC_SOUND_CAPTURE_CHAIN_DMA_EN 1
+
+/*!
+ * ID for this card
+ */
+static char *id = NULL;
+
+#define MXC_ALSA_MAX_PCM_DEV 1 /*2*/
+#define MXC_ALSA_MAX_PLAYBACK 1 /*2*/
+#define MXC_ALSA_MAX_CAPTURE 1
+
+/*!
+ * This structure is the global configuration of the soundcard
+ * that are accessed by the mixer as well as by the playback/recording
+ * stream. This contains various volume, balance, mono adder settings
+ *
+ */
+typedef struct audio_mixer_control {
+
+ /*!
+ * This variable holds the current active output device(s)
+ */
+ int output_device;
+
+ /*!
+ * This variable holds the current active input device.
+ */
+ int input_device;
+
+ /* Used only for playback/recording on codec .. Use 1 for playback
+ * and 0 for recording*/
+ int direction;
+
+ /*!
+ * This variable holds the current source for active ouput device(s)
+ */
+/* OUTPUT_SOURCE source_for_output[OP_MAXDEV];
+*/
+ /*!
+ * This variable says if a given output device is part of an ongoing
+ * playback. This variable will be set and reset by the playback stream
+ * when stream is activated and when stream is closed. This shall also
+ * be set and reset my mixer functions for enabling/disabling output devs
+ */
+/* int output_active[OP_MAXDEV];
+*/
+ /*!
+ * This variable holds the current volume for active input device.
+ * This maps to the input gain of recording device
+ */
+ int input_volume;
+
+ /*!
+ * This variable holds the current volume for playback devices.
+ */
+ //int output_volume[OP_MAXDEV];
+ int master_volume_out;
+
+ /*!
+ * This variable holds the balance setting for the mixer out.
+ * The range is 0 to 100. 50 means both L and R equal.
+ * < 50 attenuates left side and > 50 attenualtes right side
+ */
+ int mixer_balance;
+
+ /*!
+ * This variable holds the current mono adder config.
+ */
+/* PMIC_AUDIO_MONO_ADDER_MODE mixer_mono_adder;
+*/
+ /*!
+ * Semaphore used to control the access to this structure.
+ */
+ struct semaphore sem;
+
+ /*!
+ * These variables are set by PCM stream and mixer when the voice codec's / ST dac's outputs are
+ * connected to the analog mixer of PMIC audio chip
+ */
+ int codec_out_to_mixer;
+ int stdac_out_to_mixer;
+
+ int codec_playback_active;
+ int codec_capture_active;
+ int stdac_playback_active;
+
+/* PMIC_AUDIO_HANDLE stdac_handle;
+ PMIC_AUDIO_HANDLE voice_codec_handle;
+*/
+} audio_mixer_control_t;
+
+/*!
+ * This structure stores current state of audio configuration
+ * soundcard wrt a specific stream (playback on different DACs, recording on the codec etc).
+ * It is used to set/get current values and are NOT accessed by the Mixer. This structure shall
+ * be retrieved thru pcm substream pointer and hence the mixer component will have no access
+ * to it. There will be as many structures as the number of streams. In our case it's 3. Codec playback
+ * STDAC playback and voice codec recording.
+ * This structure will be used at the beginning of activating a stream to configure audio chip.
+ *
+ */
+typedef struct pmic_audio_device {
+
+/* PMIC_AUDIO_HANDLE handle;
+*/ /*!
+ * This variable holds the sample rate currently being used.
+ */
+ int sample_rate;
+
+ /*!
+ * This variable holds the current protocol PMIC is using.
+ * PMIC can use one of three protocols at any given time:
+ * normal, network and I2S.
+ */
+ int protocol;
+
+ /*!
+ * This variables tells us whether PMIC runs in
+ * master mode (PMIC generates audio clocks)or slave mode (AP side
+ * generates audio clocks)
+ *
+ * Currently the default mode is master mode because PMIC clocks have
+ * higher precision.
+ */
+ int mode;
+
+ /* This variable holds the value representing the
+ * base clock PMIC will use to generate internal
+ * clocks (BCL clock and FrameSync clock)
+ */
+ int pll;
+
+ /*!
+ * This variable holds the SSI to which PMIC is currently connected.
+ */
+ int ssi;
+
+ /*!
+ * This variable tell us whether bit clock is inverted or not.
+ */
+ int bcl_inverted;
+
+ /*!
+ * This variable tell us whether frame clock is inverted or not.
+ */
+ int fs_inverted;
+
+ /*!
+ * This variable holds the pll used for PMIC audio operations.
+ */
+ int pll_rate;
+
+ /*!
+ * This variable holds the filter that PMIC is applying to
+ * CODEC operations.
+ */
+ int codec_filter;
+
+} pmic_audio_device_t;
+
+/*!
+ * This structure represents an audio stream in term of
+ * channel DMA, HW configuration on PMIC and on AudioMux/SSI
+ */
+typedef struct audio_stream {
+ /*!
+ * identification string
+ */
+ char *id;
+
+ /*!
+ * numeric identification
+ */
+ int stream_id;
+
+ /*!
+ * SSI ID on the ARM side
+ */
+ int ssi;
+
+ /*!
+ * DAM port on the ARM side
+ */
+ int dam_port;
+
+ /*!
+ * device identifier for DMA
+ */
+ int dma_wchannel;
+
+ /*!
+ * we are using this stream for transfer now
+ */
+ int active:1;
+
+ /*!
+ * current transfer period
+ */
+ int period;
+
+ /*!
+ * current count of transfered periods
+ */
+ int periods;
+
+ /*!
+ * are we recording - flag used to do DMA trans. for sync
+ */
+ int tx_spin;
+
+ /*!
+ * Previous offset value for resume
+ */
+ unsigned int old_offset;
+#if 0
+ /*!
+ * Path for this stream
+ */
+ device_data_t stream_device;
+#endif
+
+ /*!
+ * pmic audio chip stream specific configuration
+ */
+ pmic_audio_device_t pmic_audio_device;
+
+ /*!
+ * for locking in DMA operations
+ */
+ spinlock_t dma_lock;
+
+ /*!
+ * Alsa substream pointer
+ */
+ struct snd_pcm_substream *stream;
+} audio_stream_t;
+
+/*!
+ * This structure represents the PMIC sound card with its
+ * 2 streams (StDac and Codecs) and its shared parameters
+ */
+typedef struct snd_card_mxc_pmic_audio {
+ /*!
+ * ALSA sound card handle
+ */
+ struct snd_card *card;
+
+ /*!
+ * ALSA pcm driver type handle
+ */
+ struct snd_pcm *pcm[MXC_ALSA_MAX_PCM_DEV];
+
+ /*!
+ * playback & capture streams handle
+ * We can support a maximum of two playback streams (voice-codec
+ * and ST-DAC) and 1 recording stream
+ */
+ audio_stream_t s[MXC_ALSA_MAX_CAPTURE + MXC_ALSA_MAX_PLAYBACK];
+
+} mxc_pmic_audio_t;
+
+/*!
+ * pmic audio chip parameters for IP/OP and volume controls
+ */
+audio_mixer_control_t audio_mixer_control;
+
+/*!
+ * Global variable that represents the PMIC soundcard
+ * with its 2 availables stream devices: stdac and codec
+ */
+mxc_pmic_audio_t *mxc_audio = NULL;
+
+/*!
+ * Supported playback rates array
+ */
+static unsigned int playback_rates_stereo[] = {
+ 8000,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+};
+
+/*static unsigned int playback_rates_mono[] = {
+ 8000,
+ 16000,
+};
+*/
+/*!
+ * Supported capture rates array
+ */
+static unsigned int capture_rates[] = {
+ 8000,
+ 16000,
+};
+
+/*!
+ * this structure represents the sample rates supported
+ * by PMIC for playback operations on StDac.
+ */
+static struct snd_pcm_hw_constraint_list hw_playback_rates_stereo = {
+ .count = ARRAY_SIZE(playback_rates_stereo),
+ .list = playback_rates_stereo,
+ .mask = 0,
+};
+
+/*!
+ * this structure represents the sample rates supported
+ * by PMIC for playback operations on Voice codec.
+ */
+/*static snd_pcm_hw_constraint_list_t hw_playback_rates_mono = {
+ .count = ARRAY_SIZE(playback_rates_mono),
+ .list = playback_rates_mono,
+ .mask = 0,
+};
+*/
+/*!
+ * this structure represents the sample rates supported
+ * by PMIC for capture operations on Codec.
+ */
+static struct snd_pcm_hw_constraint_list hw_capture_rates = {
+ .count = ARRAY_SIZE(capture_rates),
+ .list = capture_rates,
+ .mask = 0,
+};
+
+
+/*!
+ * This structure reprensents the capabilities of the driver
+ * in capture mode.
+ * It is used by ALSA framework.
+ */
+static struct snd_pcm_hardware snd_mxc_pmic_capture = {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000),
+ .rate_min = 8000,
+ .rate_max = 16000,
+ .channels_min = 1,
+ .channels_max = 1,
+ .buffer_bytes_max = MAX_BUFFER_SIZE,
+ .period_bytes_min = MIN_PERIOD_SIZE,
+ .period_bytes_max = DMA_BUF_SIZE,
+ .periods_min = MIN_PERIOD,
+ .periods_max = MAX_PERIOD,
+ .fifo_size = 0,
+
+};
+
+/*!
+ * This structure reprensents the capabilities of the driver
+ * in playback mode for ST-Dac.
+ * It is used by ALSA framework.
+ */
+static struct snd_pcm_hardware snd_mxc_pmic_playback_stereo = {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .rates = (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_CONTINUOUS),
+ .rate_min = 8000,
+ .rate_max = 48000,
+ .channels_min = 2,
+ .channels_max = 2,
+ .buffer_bytes_max = MAX_BUFFER_SIZE,
+ .period_bytes_min = MIN_PERIOD_SIZE,
+ .period_bytes_max = DMA_BUF_SIZE,
+ .periods_min = MIN_PERIOD,
+ .periods_max = MAX_PERIOD,
+ .fifo_size = 8,
+
+};
+
+/*!
+ * This structure reprensents the capabilities of the driver
+ * in playback mode for Voice-codec.
+ * It is used by ALSA framework.
+ */
+/*static snd_pcm_hardware_t snd_mxc_pmic_playback_mono = {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000),
+ .rate_min = 8000,
+ .rate_max = 16000,
+ .channels_min = 1,
+ .channels_max = 1,
+ .buffer_bytes_max = MAX_BUFFER_SIZE,
+ .period_bytes_min = MIN_PERIOD_SIZE,
+ .period_bytes_max = DMA_BUF_SIZE,
+ .periods_min = MIN_PERIOD,
+ .periods_max = MAX_PERIOD,
+ .fifo_size = 0,
+
+};
+*/
+
+static struct platform_device *device;
+/*!
+ * This function configures audio multiplexer to support
+ * audio data routing in PMIC master mode.
+ *
+ * @param ssi SSI of the ARM to connect to the DAM.
+ */
+void configure_dam_pmic_master(int ssi)
+{
+/* int source_port;
+ int target_port;
+
+ if (ssi == SSI1) {
+ pr_debug("DAM: port 1 -> port 4\n");
+ source_port = port_1;
+ target_port = port_4;
+ } else {
+ pr_debug("DAM: port 2 -> port 5\n");
+ source_port = port_2;
+ target_port = port_5;
+ }
+
+ dam_reset_register(source_port);
+ dam_reset_register(target_port);
+
+ dam_select_mode(source_port, normal_mode);
+ dam_select_mode(target_port, internal_network_mode);
+
+ dam_set_synchronous(source_port, true);
+ dam_set_synchronous(target_port, true);
+
+ dam_select_RxD_source(source_port, target_port);
+ dam_select_RxD_source(target_port, source_port);
+
+ dam_select_TxFS_direction(source_port, signal_out);
+ dam_select_TxFS_source(source_port, false, target_port);
+
+ dam_select_TxClk_direction(source_port, signal_out);
+ dam_select_TxClk_source(source_port, false, target_port);
+
+ dam_select_RxFS_direction(source_port, signal_out);
+ dam_select_RxFS_source(source_port, false, target_port);
+
+ dam_select_RxClk_direction(source_port, signal_out);
+ dam_select_RxClk_source(source_port, false, target_port);
+
+ dam_set_internal_network_mode_mask(target_port, 0xfc);
+
+ writel(AUD_MUX_CONF, IO_ADDRESS(AUDMUX_BASE_ADDR) + 0x38);
+*/
+}
+
+/*!
+ * This function normalizes speed given by the user
+ * if speed is not supported, the function will
+ * calculate the nearest one.
+ *
+ * @param speed speed requested by the user.
+ *
+ * @return The normalized speed.
+ */
+int adapt_speed(int speed)
+{
+
+ /* speeds from 8k to 48k */
+ if (speed >= (44100 + 48000) / 2) {
+ speed = 48000;
+ } else if (speed >= (32000 + 44100) / 2) {
+ speed = 44100;
+ } else if (speed >= (24000 + 32000) / 2) {
+ speed = 32000;
+ } else if (speed >= (22050 + 24000) / 2) {
+ speed = 24000;
+ } else if (speed >= (16000 + 22050) / 2) {
+ speed = 22050;
+ } else if (speed >= (12000 + 16000) / 2) {
+ speed = 16000;
+ } else if (speed >= (11025 + 12000) / 2) {
+ speed = 12000;
+ } else if (speed >= (8000 + 11025) / 2) {
+ speed = 11025;
+ } else {
+ speed = 8000;
+ }
+ return speed;
+}
+
+/*!
+ * This function configures the SSI in order to receive audio
+ * from PMIC (recording). Configuration of SSI consists mainly in
+ * setting the following:
+ *
+ * 1) SSI to use (SSI1 or SSI2)
+ * 2) SSI mode (normal or network. We use always network mode)
+ * 3) SSI STCCR register settings, which control the sample rate (BCL and
+ * FS clocks)
+ * 4) Watermarks for SSI FIFOs as well as timeslots to be used.
+ * 5) Enable SSI.
+ *
+ * @param substream pointer to the structure of the current stream.
+ */
+void configure_ssi_rx(struct snd_pcm_substream * substream)
+{
+ mxc_pmic_audio_t *chip;
+ audio_stream_t *s;
+ int ssi;
+
+ chip = snd_pcm_substream_chip(substream);
+ s = &chip->s[substream->pstr->stream];
+ ssi = s->ssi;
+
+ pr_debug("configure_ssi_rx: SSI %d\n", ssi + 1);
+
+ ssi_enable(ssi, false);
+ ssi_synchronous_mode(ssi, true);
+ ssi_network_mode(ssi, true);
+ ssi_i2s_mode(ssi, i2s_master);
+ ssi_system_clock(ssi, true); /*debug*/
+
+/* if (machine_is_mx27ads()) {
+ ssi_tx_clock_divide_by_two(ssi, 0);
+ ssi_tx_clock_prescaler(ssi, 0);
+ ssi_tx_frame_rate(ssi, 2);
+ }
+*/
+
+ ssi_tx_early_frame_sync(ssi, ssi_frame_sync_one_bit_before);
+ ssi_tx_frame_sync_length(ssi, ssi_frame_sync_one_bit);
+ ssi_tx_word_length(ssi, ssi_16_bits);
+
+ ssi_rx_early_frame_sync(ssi, ssi_frame_sync_one_bit_before);
+ ssi_rx_frame_sync_length(ssi, ssi_frame_sync_one_bit);
+ ssi_rx_fifo_enable(ssi, /*ssi_fifo_0,*/ true);
+ ssi_rx_bit0(ssi, true);
+
+ ssi_rx_fifo_full_watermark(ssi, /*ssi_fifo_0, RX_WATERMARK*/ 6);
+
+ /* We never use the divider by 2 implemented in SSI */
+ /*ssi_rx_clock_divide_by_two(ssi, 0);*/
+
+ /* Set prescaler range (a fixed divide-by-eight prescaler
+ * in series with the variable prescaler) to 0 as we don't
+ * need it.
+ */
+ ssi_rx_clock_prescaler(ssi, 0);
+
+ /* Currently, only supported sample length is 16 bits */
+ ssi_rx_word_length(ssi, ssi_16_bits);
+
+ /* set direction of clocks ("externally" means that clocks come
+ * from PMIC to MCU)
+ */
+ ssi_rx_frame_direction(ssi, ssi_tx_rx_externally);
+ ssi_rx_clock_direction(ssi, ssi_tx_rx_externally);
+
+ /* Frame Rate Divider Control.
+ * In Normal mode, this ratio determines the word
+ * transfer rate. In Network mode, this ration sets
+ * the number of words per frame.
+ */
+ ssi_rx_frame_rate(ssi, 2);
+
+ ssi_enable(ssi, true);
+}
+
+/*!
+ * This function configures the SSI in order to
+ * send data to PMIC. Configuration of SSI consists
+ * mainly in setting the following:
+ *
+ * 1) SSI to use (SSI1 or SSI2)
+ * 2) SSI mode (normal for normal use e.g. playback, network for mixing)
+ * 3) SSI STCCR register settings, which control the sample rate (BCL and
+ * FS clocks)
+ * 4) Watermarks for SSI FIFOs as well as timeslots to be used.
+ * 5) Enable SSI.
+ *
+ * @param substream pointer to the structure of the current stream.
+ */
+void configure_ssi_tx(struct snd_pcm_substream * substream)
+{
+ mxc_pmic_audio_t *chip;
+ audio_stream_t *s;
+ struct snd_pcm_runtime *runtime;
+ int ssi;
+ int device, stream_id = -1;
+ int perclock3;
+ device = substream->pcm->device;
+ if (device == 0)
+ stream_id = 0;
+ else if (device == 1)
+ stream_id = 2;
+
+ chip = snd_pcm_substream_chip(substream);
+ s = &chip->s[stream_id];
+ runtime = substream->runtime;
+ ssi = s->ssi;
+
+ pr_debug("configure_ssi_tx: SSI %d\n", ssi + 1);
+
+ ssi_enable(ssi, false);
+ ssi_synchronous_mode(ssi, true);
+
+/* if (runtime->channels == 1) {
+ ssi_network_mode(ssi, false);
+ } else {
+ ssi_network_mode(ssi, true);
+ }
+*/
+ /* added */
+ ssi_network_mode(ssi, true);
+ ssi_i2s_mode(ssi, i2s_master);
+ ssi_system_clock(ssi, true); /*debug*/
+
+ ssi_tx_early_frame_sync(ssi, ssi_frame_sync_one_bit_before);
+ ssi_tx_frame_sync_length(ssi, ssi_frame_sync_one_bit);
+ ssi_tx_fifo_enable(ssi, /*ssi_fifo_0,*/ true);
+ ssi_tx_bit0(ssi, true);
+
+ ssi_tx_fifo_empty_watermark(ssi, /*ssi_fifo_0, TX_WATERMARK*/ 4);
+
+ /* We never use the divider by 2 implemented in SSI */
+ /*ssi_tx_clock_divide_by_two(ssi, 0);*/
+
+ /*ssi_tx_clock_prescaler(ssi, 0);*/
+
+ /*Currently, only supported sample length is 16 bits */
+ ssi_tx_word_length(ssi, ssi_16_bits);
+
+ /* clocks are being provided by PMIC */
+ ssi_tx_frame_direction(ssi, ssi_tx_rx_externally);
+ ssi_tx_clock_direction(ssi, ssi_tx_rx_externally);
+
+/* if (runtime->channels == 1) {
+ ssi_tx_frame_rate(ssi, 1);
+ } else {
+ ssi_tx_frame_rate(ssi, 2);
+ }
+*/
+ pr_debug("rate: %d\n", runtime->rate);
+ runtime->rate = adapt_speed(runtime->rate);
+ perclock3 = imx_get_perclk3();
+ pr_debug("perclock3: %d rate: %d\n", perclock3, runtime->rate);
+ pr_debug("psr: %d \n", ((perclock3/ runtime->rate)%256));
+ if (0 != ((perclock3/ runtime->rate)%256))
+ {
+ pr_debug("pm: %d \n", ((perclock3/ runtime->rate)/8));
+ ssi_tx_clock_prescaler(ssi, 1);
+ ssi_tx_prescaler_modulus(ssi, ((perclock3/ runtime->rate)/8)-1);
+ }
+ else
+ {
+ pr_debug("pm: %d \n", ((perclock3/ runtime->rate)));
+ ssi_tx_clock_prescaler(ssi, 0);
+ ssi_tx_prescaler_modulus(ssi, (perclock3/ runtime->rate)-1);
+ }
+
+
+ ssi_tx_frame_rate(ssi, 2);
+ ssi_enable(ssi, true);
+}
+
+
+/*!
+ * This function get values to be put in PMIC registers.
+ * This values represents the sample rate that PMIC
+ * should use for current playback or recording.
+ *
+ * @param substream pointer to the structure of the current stream.
+ */
+void normalize_speed_for_pmic(struct snd_pcm_substream * substream)
+{
+ mxc_pmic_audio_t *chip;
+ audio_stream_t *s;
+ pmic_audio_device_t *pmic_device;
+ struct snd_pcm_runtime *runtime;
+ int device, stream_id = -1;
+ device = substream->pcm->device;
+ if (device == 0) {
+ if ((audio_mixer_control.codec_capture_active == 1)
+ && (substream->stream == 1)) {
+ stream_id = 1;
+ } else
+ stream_id = 0;
+ } else {
+ stream_id = 2;
+ }
+
+ chip = snd_pcm_substream_chip(substream);
+ s = &chip->s[stream_id];
+ pmic_device = &s->pmic_audio_device;
+ runtime = substream->runtime;
+
+ /* As the driver allows continuous sample rate, we must adapt the rate */
+ runtime->rate = adapt_speed(runtime->rate);
+
+ /*if (pmic_device->handle == audio_mixer_control.voice_codec_handle) {
+ switch (runtime->rate) {
+ case 8000:
+ pmic_device->sample_rate = VCODEC_RATE_8_KHZ;
+ break;
+ case 16000:
+ pmic_device->sample_rate = VCODEC_RATE_16_KHZ;
+ break;
+ default:
+ pmic_device->sample_rate = VCODEC_RATE_8_KHZ;
+ break;
+ }
+
+ } else if (pmic_device->handle == audio_mixer_control.stdac_handle) {
+ switch (runtime->rate) {
+ case 8000:
+ pmic_device->sample_rate = STDAC_RATE_8_KHZ;
+ break;
+
+ case 11025:
+ pmic_device->sample_rate = STDAC_RATE_11_025_KHZ;
+ break;
+
+ case 16000:
+ pmic_device->sample_rate = STDAC_RATE_16_KHZ;
+ break;
+
+ case 22050:
+ pmic_device->sample_rate = STDAC_RATE_22_050_KHZ;
+ break;
+
+ case 24000:
+ pmic_device->sample_rate = STDAC_RATE_24_KHZ;
+ break;
+
+ case 32000:
+ pmic_device->sample_rate = STDAC_RATE_32_KHZ;
+ break;
+
+ case 44100:
+ pmic_device->sample_rate = STDAC_RATE_44_1_KHZ;
+ break;
+
+ case 48000:
+ pmic_device->sample_rate = STDAC_RATE_48_KHZ;
+ break;
+
+ default:
+ pmic_device->sample_rate = STDAC_RATE_8_KHZ;
+ }
+ }
+*/
+}
+
+/*!
+ * This function configures number of channels for next audio operation
+ * (recording/playback) Number of channels define if sound is stereo
+ * or mono.
+ *
+ * @param substream pointer to the structure of the current stream.
+ *
+ */
+void set_pmic_channels(struct snd_pcm_substream * substream)
+{
+ mxc_pmic_audio_t *chip;
+ audio_stream_t *s;
+ struct snd_pcm_runtime *runtime;
+
+ chip = snd_pcm_substream_chip(substream);
+ s = &chip->s[substream->pstr->stream];
+ runtime = substream->runtime;
+
+/* if (runtime->channels == 2) {
+ ssi_tx_mask_time_slot(s->ssi, MASK_2_TS);
+ ssi_rx_mask_time_slot(s->ssi, MASK_2_TS);
+ } else {
+ ssi_tx_mask_time_slot(s->ssi, MASK_1_TS);
+ ssi_rx_mask_time_slot(s->ssi, MASK_1_TS);
+ }
+*/
+}
+
+/*!
+ * This function sets the input device in PMIC. It takes an
+ * ALSA value and modifies registers using pmic-specific values.
+ *
+ * @param handle Handle to the PMIC device opened
+ * @param val ALSA value. This value defines the input device that
+ * PMIC should activate to get audio signal (recording)
+ * @param enable Whether to enable or diable the input
+ */
+/*int set_mixer_input_device(PMIC_AUDIO_HANDLE handle, INPUT_DEVICES dev,
+ bool enable)
+{
+
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ if (handle != NULL) {
+ if (audio_mixer_control.input_device & SOUND_MASK_PHONEIN) {
+ pmic_audio_vcodec_set_mic(handle, MIC1_LEFT,
+ MIC1_RIGHT_MIC_MONO);
+ pmic_audio_vcodec_enable_micbias(handle, MIC_BIAS1);
+ } else {
+ pmic_audio_vcodec_set_mic_on_off(handle,
+ MIC1_LEFT,
+ MIC1_RIGHT_MIC_MONO);
+ pmic_audio_vcodec_disable_micbias(handle, MIC_BIAS1);
+ }
+ if (audio_mixer_control.input_device & SOUND_MASK_MIC) {
+ pmic_audio_vcodec_set_mic(handle, NO_MIC, MIC2_AUX);
+ pmic_audio_vcodec_enable_micbias(handle, MIC_BIAS2);
+ } else {
+ pmic_audio_vcodec_set_mic_on_off(handle, NO_MIC,
+ MIC2_AUX);
+ pmic_audio_vcodec_disable_micbias(handle, MIC_BIAS2);
+ }
+ if (audio_mixer_control.input_device & SOUND_MASK_LINE) {
+ pmic_audio_vcodec_set_mic(handle, NO_MIC, TXIN_EXT);
+ } else {
+ pmic_audio_vcodec_set_mic_on_off(handle, NO_MIC,
+ TXIN_EXT);
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+
+ }
+ switch (dev) {
+ case IP_HANDSET:
+ pr_debug("Input: SOUND_MASK_PHONEIN \n");
+ if (handle == NULL) {
+ if (enable) {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic(handle,
+ MIC1_LEFT,
+ MIC1_RIGHT_MIC_MONO);
+ pmic_audio_vcodec_enable_micbias(handle,
+ MIC_BIAS1);
+ }
+ audio_mixer_control.input_device |=
+ SOUND_MASK_PHONEIN;
+ } else {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic_on_off(handle,
+ MIC1_LEFT,
+ MIC1_RIGHT_MIC_MONO);
+ pmic_audio_vcodec_disable_micbias
+ (handle, MIC_BIAS1);
+ }
+ audio_mixer_control.input_device &=
+ ~SOUND_MASK_PHONEIN;
+ }
+ }
+ break;
+
+ case IP_HEADSET:
+ if (handle == NULL) {
+ if (enable) {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic(handle,
+ NO_MIC,
+ MIC2_AUX);
+ pmic_audio_vcodec_enable_micbias(handle,
+ MIC_BIAS2);
+ }
+ audio_mixer_control.input_device |=
+ SOUND_MASK_MIC;
+ } else {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic_on_off(handle,
+ NO_MIC,
+ MIC2_AUX);
+ pmic_audio_vcodec_disable_micbias
+ (handle, MIC_BIAS2);
+ }
+ audio_mixer_control.input_device &=
+ ~SOUND_MASK_MIC;
+ }
+ // Enable Mic with MIC2_AUX
+ }
+ break;
+
+ case IP_LINEIN:
+ if (handle == NULL) {
+ if (enable) {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic(handle,
+ NO_MIC,
+ TXIN_EXT);
+ }
+ audio_mixer_control.input_device |=
+ SOUND_MASK_LINE;
+ } else {
+ if (audio_mixer_control.codec_capture_active) {
+ handle =
+ audio_mixer_control.
+ voice_codec_handle;
+ pmic_audio_vcodec_set_mic_on_off(handle,
+ NO_MIC,
+ TXIN_EXT);
+ }
+ audio_mixer_control.input_device &=
+ ~SOUND_MASK_LINE;
+ }
+ }
+ break;
+
+ default:
+ up(&audio_mixer_control.sem);
+ return -1;
+ break;
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+}
+*/
+int get_mixer_input_device(void)
+{
+ int val;
+ val = audio_mixer_control.input_device;
+ return val;
+}
+
+/*!
+ * This function sets the PMIC input device's gain.
+ * Note that the gain is the input volume
+ *
+ * @param handle Handle to the opened PMIC device
+ * @param val gain to be applied. This value can go
+ * from 0 (mute) to 100 (max gain)
+ */
+/*int set_mixer_input_gain(PMIC_AUDIO_HANDLE handle, int val)
+{
+ int leftdb, rightdb;
+ int left, right;
+
+ left = (val & 0x00ff);
+ right = ((val & 0xff00) >> 8);
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ leftdb = (left * PMIC_INPUT_VOLUME_MAX) / INPUT_VOLUME_MAX;
+ rightdb = (right * PMIC_INPUT_VOLUME_MAX) / INPUT_VOLUME_MAX;
+ audio_mixer_control.input_volume = val;
+ if (audio_mixer_control.voice_codec_handle == handle) {
+ pmic_audio_vcodec_set_record_gain(handle, VOLTAGE_TO_VOLTAGE,
+ leftdb, VOLTAGE_TO_VOLTAGE,
+ rightdb);
+ } else if ((handle == NULL)
+ && (audio_mixer_control.codec_capture_active)) {
+ pmic_audio_vcodec_set_record_gain(audio_mixer_control.
+ voice_codec_handle,
+ VOLTAGE_TO_VOLTAGE, leftdb,
+ VOLTAGE_TO_VOLTAGE, rightdb);
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+}
+*/
+int get_mixer_input_gain(void)
+{
+ int val;
+ val = audio_mixer_control.input_volume;
+ return val;
+}
+
+/*!
+ * This function sets the PMIC output device's volume.
+ *
+ * @param handle Handle to the PMIC device opened
+ * @param volume ALSA value. This value defines the playback volume
+ * @param dev which output device gets affected by this volume
+ *
+ */
+
+/*int set_mixer_output_volume(PMIC_AUDIO_HANDLE handle, int volume,
+ OUTPUT_DEVICES dev)
+{
+ int leftdb, rightdb;
+ int right, left;
+
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ left = (volume & 0x00ff);
+ right = ((volume & 0xff00) >> 8);
+
+ leftdb = (left * PMIC_OUTPUT_VOLUME_MAX) / OUTPUT_VOLUME_MAX;
+ rightdb = (right * PMIC_OUTPUT_VOLUME_MAX) / OUTPUT_VOLUME_MAX;
+ if (handle == NULL) {
+*/ /* Invoked by mixer */
+/* audio_mixer_control.master_volume_out = volume;
+ if (audio_mixer_control.codec_playback_active)
+ pmic_audio_output_set_pgaGain(audio_mixer_control.
+ voice_codec_handle,
+ rightdb);
+ if (audio_mixer_control.stdac_playback_active)
+ pmic_audio_output_set_pgaGain(audio_mixer_control.
+ stdac_handle, rightdb);
+
+ } else {
+*/ /* change the required volume */
+/* audio_mixer_control.master_volume_out = volume;
+ pmic_audio_output_set_pgaGain(handle, rightdb);
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+}
+*/
+int get_mixer_output_volume(void)
+{
+ int val;
+ val = audio_mixer_control.master_volume_out;
+ return val;
+}
+
+/*!
+ * This function sets the PMIC output device's balance.
+ *
+ * @param bal Balance to be applied. This value can go
+ * from 0 (Left atten) to 100 (Right atten)
+ * 50 is both equal
+ */
+int set_mixer_output_balance(int bal)
+{
+/* int channel = 0;
+ PMIC_AUDIO_OUTPUT_BALANCE_GAIN b_gain;
+ PMIC_AUDIO_HANDLE handle;
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ // Convert ALSA value to PMIC value i.e. atten and channel value
+ if (bal < 0)
+ bal = 0;
+ if (bal > 100)
+ bal = 100;
+ if (bal < 50) {
+ channel = 1;
+ } else {
+ bal = 100 - bal;
+ channel = 0;
+ }
+
+ b_gain = bal / 8;
+
+ audio_mixer_control.mixer_balance = bal;
+ if (audio_mixer_control.codec_playback_active) {
+ handle = audio_mixer_control.voice_codec_handle;
+ // Use codec's handle to set balance
+ } else if (audio_mixer_control.stdac_playback_active) {
+ handle = audio_mixer_control.stdac_handle;
+ // Use STDac's handle to set balance
+ } else {
+ up(&audio_mixer_control.sem);
+ return 0;
+ }
+ if (channel == 0)
+ pmic_audio_output_set_balance(handle, BAL_GAIN_0DB, b_gain);
+ else
+ pmic_audio_output_set_balance(handle, b_gain, BAL_GAIN_0DB);
+ up(&audio_mixer_control.sem);
+*/ return 0;
+}
+
+int get_mixer_output_balance(void)
+{
+ int val;
+ val = audio_mixer_control.mixer_balance;
+ return val;
+}
+
+/*!
+ * This function sets the PMIC output device's mono adder config.
+ *
+ * @param mode Mono adder mode to be set
+ */
+/*int set_mixer_output_mono_adder(PMIC_AUDIO_MONO_ADDER_MODE mode)
+{
+ PMIC_AUDIO_HANDLE handle;
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ audio_mixer_control.mixer_mono_adder = mode;
+ if (audio_mixer_control.codec_playback_active) {
+ handle = audio_mixer_control.voice_codec_handle;
+ // Use codec's handle to set balance
+ pmic_audio_output_enable_mono_adder(audio_mixer_control.
+ voice_codec_handle, mode);
+ } else if (audio_mixer_control.stdac_playback_active) {
+ handle = audio_mixer_control.stdac_handle;
+ pmic_audio_output_enable_mono_adder(audio_mixer_control.
+ stdac_handle, mode);
+ // Use STDac's handle to set balance
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+}
+*/
+/*int get_mixer_output_mono_adder(void)
+{
+ int val;
+ val = audio_mixer_control.mixer_mono_adder;
+ return val;
+}
+*/
+/*!
+ * This function sets the output device(s) in PMIC. It takes an
+ * ALSA value and modifies registers using PMIC-specific values.
+ *
+ * @param handle handle to the device already opened
+ * @param src Source connected to o/p device
+ * @param dev Output device to be enabled
+ * @param enable Enable or disable the device
+ *
+ */
+/*int set_mixer_output_device(PMIC_AUDIO_HANDLE handle, OUTPUT_SOURCE src,
+ OUTPUT_DEVICES dev, bool enable)
+{
+ PMIC_AUDIO_OUTPUT_PORT port;
+ if (down_interruptible(&audio_mixer_control.sem))
+ return -EINTR;
+ if (!((src == CODEC_DIR_OUT) || (src == MIXER_OUT))) {
+ up(&audio_mixer_control.sem);
+ return -1;
+ }
+ if (handle != (PMIC_AUDIO_HANDLE) NULL) {
+*/ /* Invoked by playback stream */
+/* if (audio_mixer_control.output_device & SOUND_MASK_PHONEOUT) {
+ audio_mixer_control.output_active[OP_EARPIECE] = 1;
+ pmic_audio_output_set_port(handle, MONO_SPEAKER);
+ }
+ if (audio_mixer_control.output_device & SOUND_MASK_SPEAKER) {
+ audio_mixer_control.output_active[OP_HANDSFREE] = 1;
+ pmic_audio_output_set_port(handle, MONO_LOUDSPEAKER);
+ }
+ if (audio_mixer_control.output_device & SOUND_MASK_VOLUME) {
+ audio_mixer_control.output_active[OP_HEADSET] = 1;
+ pmic_audio_output_set_port(handle,
+ STEREO_HEADSET_LEFT |
+ STEREO_HEADSET_RIGHT);
+ }
+ if (audio_mixer_control.output_device & SOUND_MASK_PCM) {
+ audio_mixer_control.output_active[OP_LINEOUT] = 1;
+ pmic_audio_output_set_port(handle,
+ STEREO_OUT_LEFT |
+ STEREO_OUT_RIGHT);
+ }
+ } else {
+ switch (dev) {
+ case OP_EARPIECE:
+ if (enable) {
+ audio_mixer_control.output_device |=
+ SOUND_MASK_PHONEOUT;
+ audio_mixer_control.source_for_output[dev] =
+ src;
+ } else {
+ audio_mixer_control.output_device &=
+ ~SOUND_MASK_PHONEOUT;
+ }
+ port = MONO_SPEAKER;
+ break;
+ case OP_HANDSFREE:
+ if (enable) {
+ audio_mixer_control.output_device |=
+ SOUND_MASK_SPEAKER;
+ audio_mixer_control.source_for_output[dev] =
+ src;
+ } else {
+ audio_mixer_control.output_device &=
+ ~SOUND_MASK_SPEAKER;
+ }
+ port = MONO_LOUDSPEAKER;
+ break;
+ case OP_HEADSET:
+ if (enable) {
+ audio_mixer_control.output_device |=
+ SOUND_MASK_VOLUME;
+ audio_mixer_control.source_for_output[dev] =
+ src;
+ } else {
+ audio_mixer_control.output_device &=
+ ~SOUND_MASK_VOLUME;
+ }
+ port = STEREO_HEADSET_LEFT | STEREO_HEADSET_RIGHT;
+ break;
+ case OP_LINEOUT:
+ if (enable) {
+ audio_mixer_control.output_device |=
+ SOUND_MASK_PCM;
+ audio_mixer_control.source_for_output[dev] =
+ src;
+ } else {
+ audio_mixer_control.output_device &=
+ ~SOUND_MASK_PCM;
+ }
+ port = STEREO_OUT_LEFT | STEREO_OUT_RIGHT;
+ break;
+ default:
+ up(&audio_mixer_control.sem);
+ return -1;
+ break;
+ }
+*/ /* Invoked by mixer .. little tricky to handle over here */
+/* if (audio_mixer_control.codec_playback_active) {
+ if (enable) {
+ audio_mixer_control.output_active[dev] = 1;
+ pmic_audio_output_set_port(audio_mixer_control.
+ voice_codec_handle,
+ port);
+ } else {
+ audio_mixer_control.output_active[dev] = 0;
+ pmic_audio_output_clear_port
+ (audio_mixer_control.voice_codec_handle,
+ port);
+ }
+ }
+ if (audio_mixer_control.stdac_playback_active) {
+ if (enable) {
+ audio_mixer_control.output_active[dev] = 1;
+ pmic_audio_output_set_port(audio_mixer_control.
+ stdac_handle, port);
+ } else {
+ audio_mixer_control.output_active[dev] = 0;
+ pmic_audio_output_clear_port
+ (audio_mixer_control.stdac_handle, port);
+ }
+ }
+
+ }
+ up(&audio_mixer_control.sem);
+ return 0;
+ // Set O/P device with handle and port
+
+}
+*/
+int get_mixer_output_device(void)
+{
+ int val;
+ val = audio_mixer_control.output_device;
+ return val;
+}
+
+/*!
+ * This function configures the CODEC for playback/recording.
+ *
+ * main configured elements are:
+ * - audio path on PMIC
+ * - external clock to generate BC and FS clocks
+ * - PMIC mode (master or slave)
+ * - protocol
+ * - sample rate
+ *
+ * @param substream pointer to the structure of the current stream.
+ * @param stream_id index into the audio_stream array.
+ */
+void configure_codec(struct snd_pcm_substream * substream, int stream_id)
+{
+ mxc_pmic_audio_t *chip;
+ audio_stream_t *s;
+ pmic_audio_device_t *pmic;
+// PMIC_AUDIO_HANDLE handle;
+// int ssi_bus;
+
+ chip = snd_pcm_substream_chip(substream);
+ s = &chip->s[stream_id];
+ pmic = &s->pmic_audio_device;
+/* handle = audio_mixer_control.voice_codec_handle;
+
+ ssi_bus = (pmic->ssi == SSI1) ? AUDIO_DATA_BUS_1 : AUDIO_DATA_BUS_2;
+
+ pmic_audio_output_enable_phantom_ground(handle);
+ pmic_audio_vcodec_set_rxtx_timeslot(handle, USE_TS0);
+ pmic_audio_vcodec_enable_mixer(handle, USE_TS1, VCODEC_NO_MIX,
+ VCODEC_MIX_OUT_0DB);
+ pmic_audio_set_protocol(handle, ssi_bus, pmic->protocol, pmic->mode,
+ USE_4_TIMESLOTS);
+
+ msl...
[truncated message content] |
|
From: <ar...@us...> - 2007-08-06 08:24:23
|
Revision: 615
http://armadeus.svn.sourceforge.net/armadeus/?rev=615&view=rev
Author: artemys
Date: 2007-08-06 01:24:25 -0700 (Mon, 06 Aug 2007)
Log Message:
-----------
[BUILDROOT] Correct small bug in SDL_water patch
Modified Paths:
--------------
trunk/patches/021-buildroot-sdl-water-config.diff
Modified: trunk/patches/021-buildroot-sdl-water-config.diff
===================================================================
--- trunk/patches/021-buildroot-sdl-water-config.diff 2007-08-03 21:46:12 UTC (rev 614)
+++ trunk/patches/021-buildroot-sdl-water-config.diff 2007-08-06 08:24:25 UTC (rev 615)
@@ -1,9 +1,10 @@
---- buildroot/package/sdl/Config.in.old 2007-07-19 18:28:39.000000000 +0200
-+++ buildroot/package/sdl/Config.in 2007-07-19 18:25:07.000000000 +0200
-@@ -46,3 +46,12 @@
+--- buildroot/package/sdl/Config.in.old 2007-08-01 18:34:54.000000000 +0200
++++ buildroot/package/sdl/Config.in 2007-08-01 18:35:51.000000000 +0200
+@@ -45,3 +45,13 @@
+ This is a small sample cross-platform networking library, with a sample chat client and server application.
http://www.libsdl.org/projects/SDL_net/
-
++
+config BR2_PACKAGE_SDL_WATER
+ bool "SDL_water"
+ depends on BR2_PACKAGE_SDL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-08-03 21:52:47
|
Revision: 614
http://armadeus.svn.sourceforge.net/armadeus/?rev=614&view=rev
Author: artemys
Date: 2007-08-03 14:46:12 -0700 (Fri, 03 Aug 2007)
Log Message:
-----------
[LINUX] Add support to TSC2102 in apf9328 machine file = hardware configuration
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-07-28 17:49:54 UTC (rev 613)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-08-03 21:46:12 UTC (rev 614)
@@ -809,8 +809,8 @@
+CONFIG_ZLIB_DEFLATE=y
diff -urN linux-2.6.18.1/arch/arm/mach-imx/apf9328.c linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c
--- linux-2.6.18.1/arch/arm/mach-imx/apf9328.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c 2007-01-07 21:39:30.000000000 +0100
-@@ -0,0 +1,349 @@
++++ linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c 2007-07-22 22:46:57.000000000 +0200
+@@ -0,0 +1,463 @@
+/*
+ * linux/arch/arm/mach-imx/apf9328.c
+ *
@@ -839,6 +839,7 @@
+#include <linux/spi/spi.h>
+// Get CONFIG_ options:
+#include <linux/config.h>
++#include <linux/spi/tsc2102.h>
+
+#include <asm/system.h>
+#include <asm/hardware.h>
@@ -852,6 +853,7 @@
+#include <asm/arch/imx-uart.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/spi_imx.h>
++#include <asm/arch/imx-regs.h> // imx_gpio_mode()
+
+#ifdef CONFIG_DM9000
+#include <linux/dm9000.h>
@@ -865,6 +867,9 @@
+#ifdef CONFIG_SPI_IMX_MODULE
+#define CONFIG_SPI_IMX 1
+#endif
++#ifdef CONFIG_SPI_TSC2102_MODULE
++#define CONFIG_SPI_TSC2102 1
++#endif
+#ifdef CONFIG_IMX_BACKLIGHT_MODULE
+#define CONFIG_IMX_BACKLIGHT 1
+#endif
@@ -986,7 +991,7 @@
+};
+
+#ifdef CONFIG_SPI_IMX
-+static struct resource imx_spi0_resource[] = {
++static struct resource imx_spi1_resource[] = {
+ [0] = {
+ .start = 0x00213000,
+ .end = 0x00213fff,
@@ -999,20 +1004,49 @@
+ }
+};
+
-+static struct spi_imx_master imx_spi_master_info = {
++static struct spi_imx_master imx_spi1_master_info = {
+ .num_chipselect = 1,
+ .enable_dma=0,
+};
+
-+static struct platform_device imx_spi = {
++static struct platform_device imx_spi1 = {
+ .name = "imx-spi",
+ .id = 1,
-+ .resource = imx_spi0_resource,
-+ .num_resources = ARRAY_SIZE(imx_spi0_resource),
++ .resource = imx_spi1_resource,
++ .num_resources = ARRAY_SIZE(imx_spi1_resource),
+ .dev = {
-+ .platform_data = &imx_spi_master_info,
++ .platform_data = &imx_spi1_master_info,
+ },
+};
++
++static struct resource imx_spi2_resource[] = {
++ [0] = {
++ .start = 0x00219000,
++ .end = 0x00219fff,
++ .flags = IORESOURCE_MEM,
++ },
++ [1] = {
++ .start = SPI2_INT,
++ .end = SPI2_INT,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++static struct spi_imx_master imx_spi2_master_info = {
++ .num_chipselect = 1,
++ .enable_dma=0,
++};
++
++static struct platform_device imx_spi2 = {
++ .name = "imx-spi",
++ .id = 2,
++ .resource = imx_spi2_resource,
++ .num_resources = ARRAY_SIZE(imx_spi2_resource),
++ .dev = {
++ .platform_data = &imx_spi2_master_info,
++ },
++};
++
+#endif //CONFIG_SPI_IMX
+
+#ifdef CONFIG_SENSORS_MAX1027
@@ -1020,16 +1054,17 @@
+#define IMX_SPI1_SS (1<<15)
+static void max1027_init_cs(void)
+{
-+ // SPI CSn is used as chip select but in GPIO mode
++ // SPI CSn is used as chip select but in GPIO mode
+ OCR1(2) |= 3<<(IMX_SPI1_SS_PIN*2);
+ DDIR(2) |= IMX_SPI1_SS;
+ DR(2) |= IMX_SPI1_SS;
-+ GIUS(2) = IMX_SPI1_SS;
++ GIUS(2) |= IMX_SPI1_SS;
++ GIUS(2) &= ~(1<<14 | 1<<16 | 1<< 17); // Set SPI primary functions
+}
+static void max1027_cs(u32 command)
+{
+ if( command == SPI_CS_DEASSERT )
-+ DR(2) |= IMX_SPI1_SS;
++ DR(2) |= IMX_SPI1_SS;
+ else
+ DR(2) &= ~IMX_SPI1_SS;
+}
@@ -1038,16 +1073,90 @@
+ .cs_control = max1027_cs,
+};
+
-+static struct spi_board_info spi_board_info[] __initdata = { {
-+ .modalias = "max1027",
-+ .controller_data = &max1027_hw,
-+ .max_speed_hz = 8000000,
-+ .bus_num = 1,
-+ .chip_select = 0,
-+ .mode = 0,
++#endif // CONFIG_SENSORS_MAX1027
++
++#ifdef CONFIG_SPI_TSC2102
++#define TSC2102_CS_GPIOB 17
++static void tsc2102_init_gpio(void)
++{
++ // Activate SPI2 port ----
++ // PortB 19 is used as chip select (in GPIO mode)
++ DR(1) |= 1 << TSC2102_CS_GPIOB; // Initializes it High
++ imx_gpio_mode( GPIO_PORTB | TSC2102_CS_GPIOB | GPIO_OUT | GPIO_GIUS | GPIO_DR );
++ // Configure SPI2 outputs
++ imx_gpio_mode( PD7_AIN_SPI2_SCLK );
++ imx_gpio_mode( PD10_AIN_SPI2_TXD );
++ imx_gpio_mode( PD9_AOUT_SPI2_RXD );
++ FMCR |= SPI2_RXD_SEL; // RX is AOUT on PORTD
++
++ // PortD 8 is used as PINTDAV interrupt
++ imx_gpio_mode( GPIO_PORTD | 8 | GPIO_IN | GPIO_GIUS );
++ //imx_gpio_irq_type( IRQ_GPIOD(8), __IRQT_FALEDGE );
++
++ // Activate SSI on PortC ----
++ imx_gpio_mode( PC3_PF_SSI_RXFS );
++ FMCR &= ~(SSI_RXFS_SEL);
++ imx_gpio_mode( PC4_PF_SSI_RXCLK );
++ FMCR &= ~(SSI_RXCLK_SEL);
++ imx_gpio_mode( PC5_PF_SSI_RXDAT );
++ FMCR &= ~(SSI_RXDAT_SEL);
++ imx_gpio_mode( PC6_PF_SSI_TXDAT );
++ imx_gpio_mode( PC7_PF_SSI_TXFS );
++ FMCR &= ~(SSI_TXFS_SEL);
++ imx_gpio_mode( PC8_PF_SSI_TXCLK );
++ FMCR &= ~(SSI_TXCLK_SEL);
++
++ printk("TSC2102 GPIOs initialized\n");
++}
++
++// Chip select command for TSC2102
++static void tsc2102_cs(u32 command)
++{
++ // PortB 19 is used as chip select
++ if( command == SPI_CS_DEASSERT )
++ DR(1) |= 1<< TSC2102_CS_GPIOB;
++ else
++ DR(1) &= ~(1<< TSC2102_CS_GPIOB);
++}
++
++static struct spi_imx_chip tsc2102_hw = {
++ .cs_control = tsc2102_cs,
++};
++
++static struct tsc2102_config apf9328_tsc2102_config = {
++ .use_internal = 1, // -> use internal voltage reference
++ .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
++ .temp_at25c = { 2200, 2615 },
++/* .apm_report = palmte_get_power_status,
++ .alsa_config = &palmte_alsa_config,*/
++};
++
++#endif // CONFIG_SPI_TSC2102
++
++static struct spi_board_info spi_board_info[] __initdata = {
++#ifdef CONFIG_SENSORS_MAX1027
++{
++ .modalias = "max1027",
++ .controller_data = &max1027_hw,
++ .max_speed_hz = 8000000,
++ .bus_num = 1, // SPI1
++ .chip_select = 0,
++ .mode = 0,
+},
++#endif // CONFIG_SENSORS_MAX1027
++#ifdef CONFIG_SPI_TSC2102
++{
++ .modalias = "tsc2102",
++ .controller_data = &tsc2102_hw,
++ .max_speed_hz = 8000000,
++ .bus_num = 2, // SPI2
++ .irq = IRQ_GPIOD(8),
++ .chip_select = 0,
++ .mode = 0,
++ .platform_data = &apf9328_tsc2102_config,
++},
++#endif // CONFIG_SPI_TSC2102
+};
-+#endif // CONFIG_SENSORS_MAX1027
+
+// --- LCD RESSOURCE ---
+#ifdef CONFIG_FB_IMX
@@ -1081,7 +1190,8 @@
+ &dm9000x_device,
+#endif // CONFIG_DM9000
+#ifdef CONFIG_SPI_IMX
-+ &imx_spi,
++ &imx_spi1,
++ &imx_spi2,
+#endif //CONFIG_SPI_IMX
+ &imx_pwm_device,
+#ifdef CONFIG_IMX_BACKLIGHT
@@ -1092,7 +1202,7 @@
+static void __init apf9328_init(void)
+{
+ printk("--- Registering APF9328 ressources\n");
-+
++
+ // Serial
+ UFCR(IMX_UART1_BASE) = 0xa81;
+ UFCR(IMX_UART2_BASE) = 0xa81;
@@ -1107,11 +1217,15 @@
+#ifdef CONFIG_SENSORS_MAX1027
+ max1027_init_cs();
+#endif //CONFIG_SENSORS_MAX1027
++#ifdef CONFIG_SPI_TSC2102
++ tsc2102_init_gpio();
++#endif // CONFIG_SPI_TSC2102
+
+ platform_add_devices(devices, ARRAY_SIZE(devices));
-+#ifdef CONFIG_SENSORS_MAX1027
-+ spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
++#if defined (CONFIG_SENSORS_MAX1027) || defined (CONFIG_SPI_TSC2102)
++ spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
+#endif // CONFIG_SENSORS_MAX1027
++
+ printk("--- APF9328 ressources registered\n");
+}
+
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff 2007-08-03 21:46:12 UTC (rev 614)
@@ -0,0 +1,38 @@
+--- linux-2.6.18.1/include/asm-arm/arch-imx/imx-regs.h 2007-08-01 22:01:00.000000000 +0200
++++ linux-2.6.18.1.mod/include/asm-arm/arch-imx/imx-regs.h 2007-07-17 00:08:11.000000000 +0200
+@@ -39,6 +39,16 @@
+ #define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
+ #define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
+
++/* System control registers */
++
++#define FMCR __REG(0x1B808 + IMX_IO_BASE)
++#define SPI2_RXD_SEL (1 << 8)
++#define SSI_RXFS_SEL (1 << 7)
++#define SSI_RXCLK_SEL (1 << 6)
++#define SSI_RXDAT_SEL (1 << 5)
++#define SSI_TXFS_SEL (1 << 4)
++#define SSI_TXCLK_SEL (1 << 3)
++
+ /* PLL registers */
+ #define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
+ #define CSCR_SYSTEM_SEL (1<<16)
+@@ -216,7 +226,7 @@
+ #define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
+ #define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
+ #define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
+-#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
++#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | GPIO_OUT | 7 )
+ #define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
+ #define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
+ #define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
+--- linux-2.6.18.1/include/asm-arm/arch-imx/irqs.h 2006-10-14 05:34:03.000000000 +0200
++++ linux-2.6.18.1.mod/include/asm-arm/arch-imx/irqs.h 2007-07-15 15:59:04.000000000 +0200
+@@ -61,6 +61,7 @@
+ #define PWM_INT 34
+ #define SDHC_INT 35
+ #define I2C_INT 39
++#define SPI2_INT 40
+ #define CSPI_INT 41
+ #define SSI_TX_INT 42
+ #define SSI_TX_ERR_INT 43
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-07-28 17:49:54
|
Revision: 613
http://armadeus.svn.sourceforge.net/armadeus/?rev=613&view=rev
Author: artemys
Date: 2007-07-28 10:49:54 -0700 (Sat, 28 Jul 2007)
Log Message:
-----------
[TEST] Add Bash script to test MMC/SD cards performances
Added Paths:
-----------
trunk/target/test/
trunk/target/test/mmc/
trunk/target/test/mmc/mmc_perf.sh
Added: trunk/target/test/mmc/mmc_perf.sh
===================================================================
--- trunk/target/test/mmc/mmc_perf.sh (rev 0)
+++ trunk/target/test/mmc/mmc_perf.sh 2007-07-28 17:49:54 UTC (rev 613)
@@ -0,0 +1,173 @@
+#!/bin/sh
+
+#
+# Script to test Armadeus boards performances to handle MMC/SD cards
+#
+# Copyright (C) 2007 The Armadeus Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+# Script parameters
+MMC_MOUNT_DIR="/media/mmc"
+MMC_DEVICE="/dev/mmcblk0p1"
+TEMP_DIR="/tmp/perf_mmc/"
+TEMP_FILE="/tmp/data.bin"
+TEMP_FILE_SIZE=4096 # kbytes
+WRITE_BENCH="/tmp/test_mmc.sh"
+
+WTIME=0
+RTIME=0
+#DEBUG=True
+
+debug()
+{
+ if [ "$DEBUG" == "True" ]; then
+ echo $1
+ fi
+}
+
+get_time_in_ms_from_file()
+{
+ if [ -f "$1" ]; then
+ TIME=`cat $1 | grep real | cut -d m -f 2 | sed 's/s//'`
+ STIME=`echo $TIME | cut -d . -f 1`
+ STIME=`expr $STIME \* 1000`
+ MSTIME=`echo $TIME | cut -d . -f 2`
+ MSTIME=`expr $MSTIME \* 10`
+ NAME=`echo $1 | grep write`
+ if [ "$NAME" != "" ]; then
+ WTIME=`expr $STIME + $MSTIME`
+ debug "WTIME: $WTIME"
+ else
+ RTIME=`expr $STIME + $MSTIME`
+ debug "RTIME: $RTIME"
+ fi
+ else
+ echo "File doesn't exist"
+ fi
+}
+
+test_speed()
+{
+ # Create temp bench file
+ echo "Creating temp bench file"
+ if [ ! -f "$TEMP_FILE" ]; then
+ dd if=/dev/urandom of=/tmp/data.bin bs=1024 count=$TEMP_FILE_SIZE
+ fi
+ # Create bench script
+ echo "mv $TEMP_FILE $MMC_MOUNT_DIR" > $WRITE_BENCH
+ echo "sync" >> $WRITE_BENCH
+ echo "exit 0" >> $WRITE_BENCH
+
+ for it in 1 2 3 4 5; do
+ echo "--- Test iteration n°$it ---"
+ echo " Writing"
+ time sh $WRITE_BENCH 2>/tmp/writetime
+ umount $MMC_MOUNT_DIR && mount $MMC_DEVICE $MMC_MOUNT_DIR
+ echo " Reading"
+ time mv $MMC_MOUNT_DIR/data.bin /tmp/ 2>/tmp/readtime
+ # Update writing mean time
+ get_time_in_ms_from_file /tmp/writetime
+ if [ $it == "1" ]; then
+ WTOTIME=$WTIME
+ else
+ WTOTIME=`expr $WTIME + $WTOTIME`
+ WTOTIME=`expr $WTOTIME / 2`
+ fi
+ debug "Mean write time: $WTOTIME ms"
+ # Update reading mean time
+ get_time_in_ms_from_file /tmp/readtime
+ if [ $it == "1" ]; then
+ RTOTIME=$RTIME
+ else
+ RTOTIME=`expr $RTIME + $RTOTIME`
+ RTOTIME=`expr $RTOTIME / 2`
+ fi
+ debug "Mean reading time: $RTOTIME ms"
+ done
+ WSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $WTOTIME`
+ RSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $RTOTIME`
+ echo "--- Test result (mean values): read -> $RSPEED kBytes/sec write -> $WSPEED kBytes/sec"
+}
+
+# Check some prerequisites
+if [ ! -d $MMC_MOUNT_DIR ]; then
+ echo "Check that $MMC_MOUNT_DIR directory is existing"
+ exit 1
+fi
+IS_MOUNTED=`mount | grep -c $MMC_MOUNT_DIR`
+if [ "$IS_MOUNTED" != "1" ]; then
+ echo "Check that your MMC is mounted on $MMC_MOUNT_DIR"
+ exit 1
+fi
+
+# Process parameters
+if [ $# == 0 ]; then
+ echo -e "\n Usage: $0 [speed|integrity] \n"
+ exit 1
+fi
+
+if [ "$1" == "speed" ]; then
+ test_speed
+ exit 0
+fi
+
+
+SIZE=`df -hm | grep /media/mmc | awk '{$1=$1;print}' | cut -d " " -f 4`
+
+SIZE=40
+it=0
+mkdir -p $TEMP_DIR
+
+date
+FILE=$TEMP_DIR/test.rnd
+MD5=$TEMP_DIR/test.rnd.md5
+dd if=/dev/urandom of=$FILE bs=1024 count=1024 2>/dev/null
+md5sum $FILE > $MD5
+
+while [ $it -le $SIZE ]; do
+ FILEMMC=$MMC_MOUNT_DIR/test_$it.rnd
+# MD5=$TEMP_DIR/test_$it.rnd.md5
+ echo -en "\r Creating: $FILEMMC"
+ it=$((it+1))
+ cp $FILE $FILEMMC
+ sync
+done
+
+echo ""
+
+umount $MMC_MOUNT_DIR
+mount $MMC_DEVICE $MMC_MOUNT_DIR
+
+date
+FILES=`ls $MMC_MOUNT_DIR/*.rnd`
+for file in $FILES; do
+ file=`basename $file`
+ echo -en "\r Checking MD5 for: $file"
+ MD5MMC=`md5sum $MMC_MOUNT_DIR/$file | cut -d " " -f 1`
+ MD5ORG=`cat $MD5 | cut -d " " -f 1`
+ if [ "$MD5MMC" != "$MD5ORG" ]; then
+ echo -e "\nMD5 failed for $file: $MD5MMC $MD5ORG"
+ exit 1
+ fi
+done
+echo
+date
+echo "MMC perf test successful !"
+rm -rf $TEMP_DIR
+rm $MMC_MOUNT_DIR/*.rnd
+
+exit 0
Property changes on: trunk/target/test/mmc/mmc_perf.sh
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-07-19 16:40:18
|
Revision: 612
http://armadeus.svn.sourceforge.net/armadeus/?rev=612&view=rev
Author: artemys
Date: 2007-07-19 09:40:16 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
[BUILDROOT] Add SDL-Water demo to buildroot
Added Paths:
-----------
trunk/buildroot/package/sdl/sdl_water.mk
trunk/patches/021-buildroot-sdl-water-config.diff
Added: trunk/buildroot/package/sdl/sdl_water.mk
===================================================================
--- trunk/buildroot/package/sdl/sdl_water.mk (rev 0)
+++ trunk/buildroot/package/sdl/sdl_water.mk 2007-07-19 16:40:16 UTC (rev 612)
@@ -0,0 +1,62 @@
+#############################################################
+#
+# SDL Water Demo
+#
+#############################################################
+SDL_WATER_VERSION:=1.0
+SDL_WATER_SOURCE:=water-$(SDL_WATER_VERSION).tar.gz
+SDL_WATER_SITE:=http://www.libsdl.org/projects/water/src/
+SDL_WATER_CAT:=$(ZCAT)
+SDL_WATER_DIR:=$(BUILD_DIR)/water-$(SDL_WATER_VERSION)
+
+$(DL_DIR)/$(SDL_WATER_SOURCE):
+ $(WGET) -P $(DL_DIR) $(SDL_WATER_SITE)/$(SDL_WATER_SOURCE)
+
+sdl-water-source: $(DL_DIR)/$(SDL_WATER_SOURCE)
+
+$(SDL_WATER_DIR)/.unpacked: $(DL_DIR)/$(SDL_WATER_SOURCE)
+ $(SDL_WATER_CAT) $(DL_DIR)/$(SDL_WATER_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(SDL_WATER_DIR)/.configured: $(SDL_WATER_DIR)/.unpacked
+ (cd $(SDL_WATER_DIR); \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS) " \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=$(STAGING_DIR)/usr \
+ --with-sdl-exec-prefix=$(STAGING_DIR)/usr/ \
+ --disable-video-x11 );
+ touch $@
+
+$(SDL_WATER_DIR)/water: $(SDL_WATER_DIR)/.configured
+ $(MAKE) -C $(SDL_WATER_DIR)
+
+$(STAGING_DIR)/usr/bin/water: $(SDL_WATER_DIR)/water
+ $(MAKE) -C $(SDL_WATER_DIR) install
+ touch -c $@
+
+$(TARGET_DIR)/usr/bin/water: $(STAGING_DIR)/usr/bin/water
+ cp -dpf $< $(SDL_WATER_DIR)/water320.bmp $(TARGET_DIR)/usr/bin/
+ -$(STRIP) --strip-unneeded $@
+
+SDL-WATER sdl-water: uclibc sdl $(TARGET_DIR)/usr/bin/water
+
+sdl-water-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SDL_WATER_DIR) uninstall
+ rm $(TARGET_DIR)/usr/bin/water320.bmp
+ -$(MAKE) -C $(SDL_WATER_DIR) clean
+
+sdl-water-dirclean:
+ rm -rf $(SDL_WATER_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_SDL_WATER)),y)
+TARGETS+=sdl-water
+endif
Added: trunk/patches/021-buildroot-sdl-water-config.diff
===================================================================
--- trunk/patches/021-buildroot-sdl-water-config.diff (rev 0)
+++ trunk/patches/021-buildroot-sdl-water-config.diff 2007-07-19 16:40:16 UTC (rev 612)
@@ -0,0 +1,15 @@
+--- buildroot/package/sdl/Config.in.old 2007-07-19 18:28:39.000000000 +0200
++++ buildroot/package/sdl/Config.in 2007-07-19 18:25:07.000000000 +0200
+@@ -46,3 +46,12 @@
+
+ http://www.libsdl.org/projects/SDL_net/
+
++config BR2_PACKAGE_SDL_WATER
++ bool "SDL_water"
++ depends on BR2_PACKAGE_SDL
++ default n
++ help
++
++ Water effect demo coded with SDL
++
++ http://www.libsdl.org/projects/SDL_water/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-07-14 15:29:43
|
Revision: 611
http://armadeus.svn.sourceforge.net/armadeus/?rev=611&view=rev
Author: artemys
Date: 2007-07-14 08:29:41 -0700 (Sat, 14 Jul 2007)
Log Message:
-----------
[LINUX] Add TSC2102 core and touchscreen drivers as found on the http://source.mvista.com/git repository
Additionnal Armadeus adaptation patches will be required to compile and use this driver... so don't use it yet :-)
This commit can be seen as the hardware independant part of the stuff
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/apf9328/linux-2.6.18.1.config
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/073-linux-2.6.18-tsc2102.diff
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/074-linux-2.6.18-tsc2102-touchscreen.diff
Modified: trunk/buildroot/target/device/armadeus/apf9328/linux-2.6.18.1.config
===================================================================
--- trunk/buildroot/target/device/armadeus/apf9328/linux-2.6.18.1.config 2007-07-02 16:53:36 UTC (rev 610)
+++ trunk/buildroot/target/device/armadeus/apf9328/linux-2.6.18.1.config 2007-07-14 15:29:41 UTC (rev 611)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.18.1
-# Wed Jan 24 12:26:10 2007
+# Sat Jul 14 16:47:01 2007
#
CONFIG_ARM=y
CONFIG_MMU=y
@@ -649,6 +649,7 @@
#
# SPI Protocol Masters
#
+# CONFIG_SPI_TSC2102 is not set
#
# Dallas's 1-wire bus
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/073-linux-2.6.18-tsc2102.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/073-linux-2.6.18-tsc2102.diff (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/073-linux-2.6.18-tsc2102.diff 2007-07-14 15:29:41 UTC (rev 611)
@@ -0,0 +1,1419 @@
+From: Andrzej Zaborowski <ba...@za...>
+Date: Mon, 2 Apr 2007 17:15:00 +0000 (-0400)
+Subject: SPI: Add TSC2102 main SPI driver
+X-Git-Url: http://source.mvista.com/git/gitweb.cgi?p=linux-davinci-2.6.git;a=commitdiff;h=05f24ed7f2264675cd4c01bba62374d14db37fe9
+
+SPI: Add TSC2102 main SPI driver
+
+This adds a driver for the TSC2102 chip by Texas Instruments. This
+driver is responsible for all communication with the chip and doesn't
+export anything for user-space, but for other drivers controlling
+devices connected to the chip.
+
+Signed-off-by: Andrzej Zaborowski <ba...@za...>
+---
+
+--- a/drivers/spi/Kconfig
++++ b/drivers/spi/Kconfig
+@@ -131,6 +131,12 @@
+ #
+ # Add new SPI protocol masters in alphabetical order above this line
+ #
++config SPI_TSC2102
++ depends on SPI_MASTER
++ tristate "TSC2102 codec support"
++ ---help---
++ Say Y here if you want support for the TSC2102 chip. It
++ will be needed for the touchscreen driver on some boards.
+
+
+ # (slave support would go here)
+--- a/drivers/spi/Makefile
++++ a/drivers/spi/Makefile
+@@ -21,6 +21,7 @@
+ # ... add above this line ...
+
+ # SPI protocol drivers (device/link on bus)
++obj-$(CONFIG_SPI_TSC2102) += tsc2102.o
+ # ... add above this line ...
+
+ # SPI slave controller drivers (upstream link)
+--- /dev/null
++++ b/drivers/spi/tsc2102.c
+@@ -0,0 +1,1198 @@
++/*
++ * drivers/spi/tsc2102.c
++ *
++ * TSC2102 interface driver.
++ *
++ * Copyright (c) 2005 Andrzej Zaborowski <ba...@za...>
++ *
++ * This package is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This package is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this package; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/sched.h>
++#include <linux/errno.h>
++#include <linux/platform_device.h>
++#include <linux/delay.h>
++#include <linux/suspend.h>
++#include <linux/interrupt.h>
++#include <linux/clk.h>
++#include <linux/spi/spi.h>
++#include <linux/spi/tsc2102.h>
++#include <linux/err.h>
++#include <linux/hwmon.h>
++#include <linux/hwmon-sysfs.h>
++
++#include <asm/system.h>
++#include <asm/irq.h>
++#include <asm/io.h>
++#include <asm/mach-types.h>
++#include <asm/hardware.h>
++
++#ifdef CONFIG_APM
++#include <asm/apm.h>
++#endif
++
++/* Bit field definitions for chip registers */
++#define TSC2102_ADC_TS_CONTROL 0x8bf4
++#define TSC2102_ADC_SCAN_CONTROL 0x2ff4
++#define TSC2102_ADC_T1_CONTROL 0x2bf4
++#define TSC2102_ADC_T2_CONTROL 0x33f4
++#define TSC2102_ADC_DAV 0x4000
++#define TSC2102_ADC_INT_REF 0x0016
++#define TSC2102_ADC_EXT_REF 0x0002
++#define TSC2102_CONFIG_TIMES 0x0008
++#define TSC2102_RESET 0xbb00
++#define TSC2102_ADC_PSTCM (1 << 15)
++#define TSC2102_ADC_ADST (1 << 14)
++#define TSC2102_TS_DAV 0x0780
++#define TSC2102_PS_DAV 0x0078
++#define TSC2102_T1_DAV 0x0004
++#define TSC2102_T2_DAV 0x0002
++#define TSC2102_DAC_ON 0x3ba0
++#define TSC2102_DAC_OFF 0xafa0
++#define TSC2102_FS44K (1 << 13)
++#define TSC2102_PLL1_OFF 0x0000
++#define TSC2102_PLL1_44K 0x811c
++#define TSC2102_PLL1_48K 0x8120
++#define TSC2102_PLL2_44K (5462 << 2)
++#define TSC2102_PLL2_48K (1920 << 2)
++#define TSC2102_SLVMS (1 << 11)
++#define TSC2102_DEEMPF (1 << 0)
++#define TSC2102_BASSBC (1 << 1)
++#define TSC2102_KEYCLICK_OFF 0x0000
++
++#define CS_CHANGE(val) 0
++
++struct tsc2102_spi_req {
++ struct spi_device *dev;
++ uint16_t command;
++ uint16_t data;
++ struct spi_transfer *transfer;
++ struct spi_message message;
++};
++
++struct tsc2102_dev {
++ struct tsc2102_config *pdata;
++ spinlock_t lock, lock_sync;
++ struct clk *bclk_ck;
++
++ int state; /* 0: TS, 1: Portscan, 2-3: Temps */
++ struct timer_list ts_timer; /* Busy-wait for PEN UP */
++ struct timer_list mode_timer; /* Change .state every some time */
++ int pendown;
++ int data_pending;
++ uint16_t status, adc_status, adc_data[4];
++ tsc2102_touch_t touch_cb;
++ tsc2102_coords_t coords_cb;
++ tsc2102_ports_t ports_cb;
++ tsc2102_temp_t temp1_cb;
++ tsc2102_temp_t temp2_cb;
++ unsigned int ts_msecs; /* Interval for .ts_timer */
++ unsigned int mode_msecs; /* Interval for .mode_timer */
++
++ struct spi_device *spi;
++ struct spi_transfer *transfers;
++ struct tsc2102_spi_req req_adc;
++ struct tsc2102_spi_req req_status;
++ struct tsc2102_spi_req req_pressure;
++ struct tsc2102_spi_req req_stopadc;
++ struct tsc2102_spi_req req_mode;
++
++ int bat[2], aux[1], temp[2];
++ struct class_device *hwmondev;
++};
++
++static struct tsc2102_dev tsc;
++
++module_param_named(touch_check_msecs, tsc.ts_msecs, uint, 0);
++MODULE_PARM_DESC(touch_check_msecs, "Pen-up polling interval in msecs");
++
++module_param_named(sensor_scan_msecs, tsc.mode_msecs, uint, 0);
++MODULE_PARM_DESC(sensor_scan_msecs, "Temperature & battery scan interval");
++
++void tsc2102_write_sync(int page, u8 address, u16 data)
++{
++ static struct tsc2102_spi_req req;
++ static struct spi_transfer transfer[2];
++ int ret;
++
++ spi_message_init(&req.message);
++ req.transfer = transfer;
++
++ /* Address */
++ req.command = (page << 11) | (address << 5);
++ req.transfer[0].tx_buf = &req.command;
++ req.transfer[0].rx_buf = 0;
++ req.transfer[0].len = 2;
++ spi_message_add_tail(&req.transfer[0], &req.message);
++
++ /* Data */
++ req.transfer[1].tx_buf = &data;
++ req.transfer[1].rx_buf = 0;
++ req.transfer[1].len = 2;
++ req.transfer[1].cs_change = CS_CHANGE(1);
++ spi_message_add_tail(&req.transfer[1], &req.message);
++
++ ret = spi_sync(tsc.spi, &req.message);
++ if (!ret && req.message.status)
++ ret = req.message.status;
++
++ if (ret)
++ printk(KERN_ERR "%s: error %i in SPI request\n",
++ __FUNCTION__, ret);
++}
++
++void tsc2102_reads_sync(int page, u8 startaddress, u16 *data, int numregs)
++{
++ static struct tsc2102_spi_req req;
++ static struct spi_transfer transfer[6];
++ int ret, i, j;
++
++ BUG_ON(numregs + 1 > ARRAY_SIZE(transfer));
++
++ spi_message_init(&req.message);
++ req.transfer = transfer;
++ i = 0;
++ j = 0;
++
++ /* Address */
++ req.command = 0x8000 | (page << 11) | (startaddress << 5);
++ req.transfer[i].tx_buf = &req.command;
++ req.transfer[i].rx_buf = 0;
++ req.transfer[i].len = 2;
++ spi_message_add_tail(&req.transfer[i ++], &req.message);
++
++ /* Data */
++ while (j < numregs) {
++ req.transfer[i].tx_buf = 0;
++ req.transfer[i].rx_buf = &data[j ++];
++ req.transfer[i].len = 2;
++ req.transfer[i].cs_change = CS_CHANGE(j == numregs);
++ spi_message_add_tail(&req.transfer[i ++], &req.message);
++ }
++
++ ret = spi_sync(tsc.spi, &req.message);
++ if (!ret && req.message.status)
++ ret = req.message.status;
++
++ if (ret)
++ printk(KERN_ERR "%s: error %i in SPI request\n",
++ __FUNCTION__, ret);
++}
++
++u16 tsc2102_read_sync(int page, u8 address)
++{
++ u16 ret;
++ tsc2102_reads_sync(page, address, &ret, 1);
++ return ret;
++}
++
++static void tsc2102_write_async(
++ struct tsc2102_spi_req *spi, int page, u8 address, u16 data,
++ void (*complete)(struct tsc2102_dev *context))
++{
++ int ret;
++
++ spi_message_init(&spi->message);
++ spi->message.complete = (void (*)(void *)) complete;
++ spi->message.context = &tsc;
++
++ /* Address */
++ spi->command = (page << 11) | (address << 5);
++ spi->transfer[0].tx_buf = &spi->command;
++ spi->transfer[0].rx_buf = 0;
++ spi->transfer[0].len = 2;
++ spi_message_add_tail(&spi->transfer[0], &spi->message);
++
++ /* Data */
++ spi->data = data;
++ spi->transfer[1].tx_buf = &spi->data;
++ spi->transfer[1].rx_buf = 0;
++ spi->transfer[1].len = 2;
++ spi->transfer[1].cs_change = CS_CHANGE(1);
++ spi_message_add_tail(&spi->transfer[1], &spi->message);
++
++ ret = spi_async(spi->dev, &spi->message);
++ if (ret)
++ printk(KERN_ERR "%s: error %i in SPI request\n",
++ __FUNCTION__, ret);
++}
++
++static void tsc2102_reads_async(struct tsc2102_spi_req *spi,
++ int page, u8 startaddress, u16 *data, int numregs,
++ void (*complete)(struct tsc2102_dev *context))
++{
++ int ret, i, j;
++
++ spi_message_init(&spi->message);
++ spi->message.complete = (void (*)(void *)) complete;
++ spi->message.context = &tsc;
++ i = 0;
++ j = 0;
++
++ /* Address */
++ spi->command = 0x8000 | (page << 11) | (startaddress << 5);
++ spi->transfer[i].tx_buf = &spi->command;
++ spi->transfer[i].rx_buf = 0;
++ spi->transfer[i].len = 2;
++ spi_message_add_tail(&spi->transfer[i ++], &spi->message);
++
++ /* Data */
++ while (j < numregs) {
++ spi->transfer[i].tx_buf = 0;
++ spi->transfer[i].rx_buf = &data[j ++];
++ spi->transfer[i].len = 2;
++ spi->transfer[i].cs_change = CS_CHANGE(j == numregs);
++ spi_message_add_tail(&spi->transfer[i ++], &spi->message);
++ }
++
++ ret = spi_async(spi->dev, &spi->message);
++ if (ret)
++ printk(KERN_ERR "%s: error %i in SPI request\n",
++ __FUNCTION__, ret);
++}
++
++static void tsc2102_read_async(struct tsc2102_spi_req *spi,
++ int page, u8 address, u16 *ret,
++ void (*complete)(struct tsc2102_dev *context))
++{
++ tsc2102_reads_async(spi, page, address, ret, 1, complete);
++}
++
++static void tsc2102_request_alloc(struct tsc2102_dev *dev,
++ struct tsc2102_spi_req *spi, int direction, int numregs,
++ struct spi_transfer **buffer)
++{
++ spi->dev = dev->spi;
++
++ if (direction == 1) /* Write */
++ numregs = 2;
++ else /* Read */
++ numregs += 1;
++
++ spi->transfer = *buffer;
++ *buffer += numregs;
++}
++
++#define tsc2102_cb_register_func(cb, cb_t) \
++int tsc2102_ ## cb(cb_t handler) \
++{ \
++ spin_lock(&tsc.lock); \
++ \
++ /* Lock the module */ \
++ if (handler && !tsc.cb) \
++ if (!try_module_get(THIS_MODULE)) { \
++ printk(KERN_INFO "Failed to get TSC module\n"); \
++ } \
++ if (!handler && tsc.cb) \
++ module_put(THIS_MODULE); \
++ \
++ tsc.cb = handler; \
++ \
++ spin_unlock(&tsc.lock); \
++ return 0; \
++}
++
++tsc2102_cb_register_func(touch_cb, tsc2102_touch_t)
++tsc2102_cb_register_func(coords_cb, tsc2102_coords_t)
++tsc2102_cb_register_func(ports_cb, tsc2102_ports_t)
++tsc2102_cb_register_func(temp1_cb, tsc2102_temp_t)
++tsc2102_cb_register_func(temp2_cb, tsc2102_temp_t)
++
++#ifdef DEBUG
++static void tsc2102_print_dav(void)
++{
++ u16 status = tsc2102_read_sync(TSC2102_TS_STATUS_CTRL);
++ if (status & 0x0fff)
++ printk("TSC2102: data in");
++ if (status & 0x0400)
++ printk(" X");
++ if (status & 0x0200)
++ printk(" Y");
++ if (status & 0x0100)
++ printk(" Z1");
++ if (status & 0x0080)
++ printk(" Z2");
++ if (status & 0x0040)
++ printk(" BAT1");
++ if (status & 0x0020)
++ printk(" BAT2");
++ if (status & 0x0010)
++ printk(" AUX1");
++ if (status & 0x0008)
++ printk(" AUX2");
++ if (status & 0x0004)
++ printk(" TEMP1");
++ if (status & 0x0002)
++ printk(" TEMP2");
++ if (status & 0x0001)
++ printk(" KP");
++ if (status & 0x0fff)
++ printk(".\n");
++}
++#endif
++
++static void tsc2102_complete_dummy(struct tsc2102_dev *dev)
++{
++}
++
++static inline void tsc2102_touchscreen_mode(struct tsc2102_dev *dev)
++{
++ /* Scan X, Y, Z1, Z2, chip controlled, 12-bit, 16 samples, 500 usec */
++ tsc2102_write_async(&dev->req_mode,
++ TSC2102_TS_ADC_CTRL, TSC2102_ADC_TS_CONTROL,
++ tsc2102_complete_dummy);
++}
++
++static inline void tsc2102_portscan_mode(struct tsc2102_dev *dev)
++{
++ /* Scan BAT1, BAT2, AUX, 12-bit, 16 samples, 500 usec */
++ tsc2102_write_async(&dev->req_mode,
++ TSC2102_TS_ADC_CTRL, TSC2102_ADC_SCAN_CONTROL,
++ tsc2102_complete_dummy);
++}
++
++static inline void tsc2102_temp1_mode(struct tsc2102_dev *dev)
++{
++ /* Scan TEMP1, 12-bit, 16 samples, 500 usec */
++ tsc2102_write_async(&dev->req_mode,
++ TSC2102_TS_ADC_CTRL, TSC2102_ADC_T1_CONTROL,
++ tsc2102_complete_dummy);
++}
++
++static inline void tsc2102_temp2_mode(struct tsc2102_dev *dev)
++{
++ /* Scan TEMP2, 12-bit, 16 samples, 500 usec */
++ tsc2102_write_async(&dev->req_mode,
++ TSC2102_TS_ADC_CTRL, TSC2102_ADC_T2_CONTROL,
++ tsc2102_complete_dummy);
++}
++
++static void tsc2102_mode(struct tsc2102_dev *dev)
++{
++ switch (dev->state) {
++ case 0:
++ tsc2102_touchscreen_mode(dev);
++ break;
++ case 1:
++ tsc2102_portscan_mode(dev);
++ break;
++ case 2:
++ tsc2102_temp1_mode(dev);
++ break;
++ case 3:
++ tsc2102_temp2_mode(dev);
++ break;
++ default:
++ dev->state = 0;
++ tsc2102_touchscreen_mode(dev);
++ break;
++ }
++}
++
++/* Lock is held when this is called. */
++static void tsc2102_new_mode(struct tsc2102_dev *dev)
++{
++ /* Abort current conversion if any */
++ tsc2102_write_async(&dev->req_stopadc,
++ TSC2102_TS_ADC_CTRL, TSC2102_ADC_ADST,
++ tsc2102_complete_dummy);
++
++ dev->state ++;
++ tsc2102_mode(dev);
++}
++
++static void tsc2102_check_status(struct tsc2102_dev *dev);
++
++/* TSC has new data for us availiable. */
++static irqreturn_t tsc2102_handler(int irq, void *dev_id)
++{
++ struct tsc2102_dev *dev = (struct tsc2102_dev *) dev_id;
++ spin_lock_irq(&dev->lock);
++
++ if (!dev->data_pending)
++ tsc2102_check_status(dev);
++
++ dev->data_pending ++;
++
++ spin_unlock_irq(&dev->lock);
++ return IRQ_HANDLED;
++}
++
++static void tsc2102_data_report(struct tsc2102_dev *dev)
++{
++ if (dev->status & TSC2102_TS_DAV) {
++ if (dev->coords_cb)
++ dev->coords_cb(
++ dev->adc_data[0], dev->adc_data[1],
++ dev->adc_data[2], dev->adc_data[3]);
++ }
++
++ if (dev->status & TSC2102_PS_DAV) {
++ if (dev->ports_cb)
++ dev->ports_cb(dev->adc_data[0],
++ dev->adc_data[1], dev->adc_data[2]);
++ dev->bat[0] = dev->adc_data[0];
++ dev->bat[1] = dev->adc_data[1];
++ dev->aux[0] = dev->adc_data[2];
++ }
++
++ if (dev->status & TSC2102_T1_DAV) {
++ if (dev->temp1_cb)
++ dev->temp1_cb(*dev->adc_data);
++ dev->temp[0] = *dev->adc_data;
++ }
++
++ if (dev->status & TSC2102_T2_DAV) {
++ if (dev->temp2_cb)
++ dev->temp2_cb(*dev->adc_data);
++ dev->temp[1] = *dev->adc_data;
++ }
++
++ spin_lock_irq(&dev->lock);
++
++ dev->data_pending --;
++
++ /*
++ * This may happen if the registers were successfully read and a
++ * new conversion was started and completed by the TSC before the
++ * completion for SPI read was called.
++ */
++ if (dev->data_pending)
++ tsc2102_check_status(dev);
++
++ if (dev->status & (TSC2102_PS_DAV | TSC2102_T1_DAV | TSC2102_T2_DAV))
++ tsc2102_new_mode(dev);
++
++ spin_unlock_irq(&dev->lock);
++}
++
++static void tsc2102_status_report(struct tsc2102_dev *dev)
++{
++ /*
++ * Read all converted data from corresponding registers
++ * so that the ADC can move on to a new conversion.
++ */
++ if (dev->status & TSC2102_TS_DAV) {
++ tsc2102_reads_async(&dev->req_adc, TSC2102_TS_X,
++ dev->adc_data, 4, tsc2102_data_report);
++ if (!dev->pendown) {
++ dev->pendown = 1;
++ if (dev->touch_cb)
++ dev->touch_cb(1);
++
++ mod_timer(&dev->ts_timer, jiffies +
++ msecs_to_jiffies(dev->ts_msecs));
++ }
++ }
++
++ if (dev->status & TSC2102_PS_DAV) {
++ tsc2102_reads_async(&dev->req_adc, TSC2102_TS_BAT1,
++ dev->adc_data, 3, tsc2102_data_report);
++ }
++
++ if (dev->status & TSC2102_T1_DAV) {
++ tsc2102_read_async(&dev->req_adc, TSC2102_TS_TEMP1,
++ dev->adc_data, tsc2102_data_report);
++ }
++
++ if (dev->status & TSC2102_T2_DAV) {
++ tsc2102_read_async(&dev->req_adc, TSC2102_TS_TEMP2,
++ dev->adc_data, tsc2102_data_report);
++ }
++
++ if (!(dev->status & (TSC2102_TS_DAV | TSC2102_PS_DAV |
++ TSC2102_T1_DAV | TSC2102_T2_DAV))) {
++ spin_lock_irq(&dev->lock);
++ dev->data_pending --;
++ spin_unlock_irq(&dev->lock);
++
++ WARN_ON(!dev->state);
++ }
++}
++
++static void tsc2102_check_status(struct tsc2102_dev *dev)
++{
++ tsc2102_read_async(&dev->req_status, TSC2102_TS_STATUS_CTRL,
++ &dev->status, tsc2102_status_report);
++}
++
++static void tsc2102_mode_timer(unsigned long data)
++{
++ struct tsc2102_dev *dev = (struct tsc2102_dev *) data;
++ spin_lock_irq(&dev->lock);
++
++ BUG_ON(dev->state);
++
++ tsc2102_new_mode(dev);
++
++ mod_timer(&dev->mode_timer, jiffies +
++ msecs_to_jiffies(dev->mode_msecs));
++ spin_unlock_irq(&dev->lock);
++}
++
++/*
++ * There are at least three ways to check for pen-up:
++ * - the PINT/DAV pin state,
++ * - reading PSTCM bit in ADC Control register (D15, offset 0x00),
++ * - reading ADST bit in ADC Control register (D14, offset 0x00),
++ * ADC idle would indicate no screen touch.
++ * Unfortunately none of them seems to be 100% accurate and you will
++ * find they are totally inconsistent, i.e. you get to see any arbitrary
++ * combination of values in these three bits. So we will busy-wait
++ * for a moment when all three indicate a pen-up, using a timer, before
++ * we report a pen-up.
++ */
++static void tsc2102_pressure_report(struct tsc2102_dev *dev)
++{
++ if (!dev->pendown)
++ return;
++
++ if (dev->state ||
++ (dev->adc_status & TSC2102_ADC_PSTCM) ||
++ !(dev->adc_status & TSC2102_ADC_ADST)) {
++ mod_timer(&dev->ts_timer, jiffies +
++ msecs_to_jiffies(dev->ts_msecs));
++ } else {
++ dev->pendown = 0;
++ if (dev->touch_cb)
++ dev->touch_cb(0);
++ }
++}
++
++static void tsc2102_pressure(unsigned long data)
++{
++ struct tsc2102_dev *dev = (struct tsc2102_dev *) data;
++
++ BUG_ON(!dev->pendown);
++
++ tsc2102_read_async(&dev->req_pressure, TSC2102_TS_ADC_CTRL,
++ &dev->adc_status, tsc2102_pressure_report);
++}
++
++#ifdef CONFIG_SOUND
++/*
++ * Volume level values should be in the range [0, 127].
++ * Higher values mean lower volume.
++ */
++void tsc2102_set_volume(uint8_t left_ch, uint8_t right_ch)
++{
++ u16 val;
++ if (left_ch == 0x00 || left_ch == 0x7f) /* All 0's or all 1's */
++ left_ch ^= 0x7f;
++ if (right_ch == 0x00 || right_ch == 0x7f)
++ right_ch ^= 0x7f;
++
++ spin_lock(&tsc.lock_sync);
++
++ val = tsc2102_read_sync(TSC2102_DAC_GAIN_CTRL);
++
++ val &= 0x8080; /* Preserve mute-bits */
++ val |= (left_ch << 8) | right_ch;
++
++ tsc2102_write_sync(TSC2102_DAC_GAIN_CTRL, val);
++
++ spin_unlock(&tsc.lock_sync);
++}
++
++void tsc2102_set_mute(int left_ch, int right_ch)
++{
++ u16 val;
++ spin_lock(&tsc.lock_sync);
++
++ val = tsc2102_read_sync(TSC2102_DAC_GAIN_CTRL);
++
++ val &= 0x7f7f; /* Preserve volume settings */
++ val |= (left_ch << 15) | (right_ch << 7);
++
++ tsc2102_write_sync(TSC2102_DAC_GAIN_CTRL, val);
++
++ spin_unlock(&tsc.lock_sync);
++}
++
++void tsc2102_get_mute(int *left_ch, int *right_ch)
++{
++ u16 val;
++ spin_lock(&tsc.lock_sync);
++
++ val = tsc2102_read_sync(TSC2102_DAC_GAIN_CTRL);
++
++ spin_unlock(&tsc.lock_sync);
++
++ *left_ch = !!(val & (1 << 15));
++ *right_ch = !!(val & (1 << 7));
++}
++
++void tsc2102_set_deemphasis(int enable)
++{
++ u16 val;
++ spin_lock(&tsc.lock_sync);
++ val = tsc2102_read_sync(TSC2102_DAC_POWER_CTRL);
++
++ if (enable)
++ val &= ~TSC2102_DEEMPF;
++ else
++ val |= TSC2102_DEEMPF;
++
++ tsc2102_write_sync(TSC2102_DAC_POWER_CTRL, val);
++ spin_unlock(&tsc.lock_sync);
++}
++
++void tsc2102_set_bassboost(int enable)
++{
++ u16 val;
++ spin_lock(&tsc.lock_sync);
++ val = tsc2102_read_sync(TSC2102_DAC_POWER_CTRL);
++
++ if (enable)
++ val &= ~TSC2102_BASSBC;
++ else
++ val |= TSC2102_BASSBC;
++
++ tsc2102_write_sync(TSC2102_DAC_POWER_CTRL, val);
++ spin_unlock(&tsc.lock_sync);
++}
++
++/* {rate, dsor, fsref} */
++static const struct tsc2102_rate_info_s tsc2102_rates[] = {
++ /* Fsref / 6.0 */
++ {7350, 63, 1},
++ {8000, 63, 0},
++ /* Fsref / 6.0 */
++ {7350, 54, 1},
++ {8000, 54, 0},
++ /* Fsref / 5.0 */
++ {8820, 45, 1},
++ {9600, 45, 0},
++ /* Fsref / 4.0 */
++ {11025, 36, 1},
++ {12000, 36, 0},
++ /* Fsref / 3.0 */
++ {14700, 27, 1},
++ {16000, 27, 0},
++ /* Fsref / 2.0 */
++ {22050, 18, 1},
++ {24000, 18, 0},
++ /* Fsref / 1.5 */
++ {29400, 9, 1},
++ {32000, 9, 0},
++ /* Fsref */
++ {44100, 0, 1},
++ {48000, 0, 0},
++
++ {0, 0, 0},
++};
++
++int tsc2102_set_rate(int rate)
++{
++ int i;
++ uint16_t val;
++
++ for (i = 0; tsc2102_rates[i].sample_rate; i ++)
++ if (tsc2102_rates[i].sample_rate == rate)
++ break;
++ if (tsc2102_rates[i].sample_rate == 0) {
++ printk(KERN_ERR "Unknown sampling rate %i.0 Hz\n", rate);
++ return -EINVAL;
++ }
++
++ spin_lock(&tsc.lock_sync);
++
++ tsc2102_write_sync(TSC2102_AUDIO1_CTRL, tsc2102_rates[i].divisor);
++
++ val = tsc2102_read_sync(TSC2102_AUDIO3_CTRL);
++
++ if (tsc2102_rates[i].fs_44k) {
++ tsc2102_write_sync(TSC2102_AUDIO3_CTRL, val | TSC2102_FS44K);
++ /* Enable Phase-locked-loop, set up clock dividers */
++ tsc2102_write_sync(TSC2102_PLL1_CTRL, TSC2102_PLL1_44K);
++ tsc2102_write_sync(TSC2102_PLL2_CTRL, TSC2102_PLL2_44K);
++ } else {
++ tsc2102_write_sync(TSC2102_AUDIO3_CTRL, val & ~TSC2102_FS44K);
++ /* Enable Phase-locked-loop, set up clock dividers */
++ tsc2102_write_sync(TSC2102_PLL1_CTRL, TSC2102_PLL1_48K);
++ tsc2102_write_sync(TSC2102_PLL2_CTRL, TSC2102_PLL2_48K);
++ }
++
++ spin_unlock(&tsc.lock_sync);
++ return 0;
++}
++
++/*
++ * Perform basic set-up with default values and power the DAC on.
++ */
++void tsc2102_dac_power(int state)
++{
++ spin_lock(&tsc.lock_sync);
++
++ if (state) {
++ /* 16-bit words, DSP mode, sample at Fsref */
++ tsc2102_write_sync(TSC2102_AUDIO1_CTRL, 0x0100);
++ /* Keyclicks off, soft-stepping at normal rate */
++ tsc2102_write_sync(TSC2102_AUDIO2_CTRL, TSC2102_KEYCLICK_OFF);
++ /* 44.1 kHz Fsref, continuous transfer mode, master DAC */
++ tsc2102_write_sync(TSC2102_AUDIO3_CTRL, 0x2800);
++ /* Soft-stepping enabled */
++ tsc2102_write_sync(TSC2102_AUDIO4_CTRL, 0x0000);
++
++ /* PLL generates 44.1 kHz */
++ tsc2102_write_sync(TSC2102_PLL1_CTRL, TSC2102_PLL1_44K);
++ tsc2102_write_sync(TSC2102_PLL2_CTRL, TSC2102_PLL2_44K);
++
++ /* Codec & DAC power up, virtual ground disabled */
++ tsc2102_write_sync(TSC2102_DAC_POWER_CTRL, TSC2102_DAC_ON);
++ } else {
++ /* All off */
++ tsc2102_write_sync(TSC2102_AUDIO4_CTRL, TSC2102_KEYCLICK_OFF);
++ tsc2102_write_sync(TSC2102_PLL1_CTRL, TSC2102_PLL1_OFF);
++ }
++
++ spin_unlock(&tsc.lock_sync);
++}
++
++void tsc2102_set_i2s_master(int state)
++{
++ uint16_t val;
++ spin_lock(&tsc.lock_sync);
++
++ val = tsc2102_read_sync(TSC2102_AUDIO3_CTRL);
++
++ if (state)
++ tsc2102_write_sync(TSC2102_AUDIO3_CTRL, val | TSC2102_SLVMS);
++ else
++ tsc2102_write_sync(TSC2102_AUDIO3_CTRL, val & ~TSC2102_SLVMS);
++
++ spin_unlock(&tsc.lock_sync);
++}
++#endif /* CONFIG_SOUND */
++
++static int tsc2102_configure(struct tsc2102_dev *dev)
++{
++ /* Reset the chip */
++ tsc2102_write_sync(TSC2102_TS_RESET_CTRL, TSC2102_RESET);
++
++ /* Reference mode, 100 usec delay, 1.25 V reference */
++ if (dev->pdata->use_internal)
++ tsc2102_write_sync(TSC2102_TS_REF_CTRL, TSC2102_ADC_INT_REF);
++ else
++ tsc2102_write_sync(TSC2102_TS_REF_CTRL, TSC2102_ADC_EXT_REF);
++
++ /* 84 usec precharge time, 32 usec sense time */
++ tsc2102_write_sync(TSC2102_TS_CONFIG_CTRL, TSC2102_CONFIG_TIMES);
++
++ /* PINT/DAV acts as DAV */
++ tsc2102_write_sync(TSC2102_TS_STATUS_CTRL, TSC2102_ADC_DAV);
++
++ tsc2102_mode(dev);
++ mod_timer(&dev->mode_timer, jiffies +
++ msecs_to_jiffies(dev->mode_msecs));
++ return 0;
++}
++
++/*
++ * Retrieves chip revision. Should be always 1.
++ */
++int tsc2102_get_revision(void)
++{
++ return tsc2102_read_sync(TSC2102_AUDIO3_CTRL) & 7;
++}
++
++/*
++ * Emit a short keyclick typically in order to give feedback to
++ * user on specific events.
++ *
++ * amplitude must be between 0 (lowest) and 2 (highest).
++ * freq must be between 0 (corresponds to 62.5 Hz) and 7 (8 kHz).
++ * length should be between 2 and 32 periods.
++ *
++ * This function sleeps but doesn't sleep until the sound has
++ * finished.
++ */
++void tsc2102_keyclick(int amplitude, int freq, int length)
++{
++ u16 val;
++ spin_lock(&tsc.lock_sync);
++ val = tsc2102_read_sync(TSC2102_AUDIO2_CTRL);
++ val &= 0x800f;
++
++ /* Set amplitude */
++ switch (amplitude) {
++ case 1:
++ val |= 4 << 12;
++ break;
++ case 2:
++ val |= 7 << 12;
++ break;
++ default:
++ break;
++ }
++
++ /* Frequency */
++ val |= (freq & 0x7) << 8;
++
++ /* Round to nearest supported length */
++ if (length > 20)
++ val |= 4 << 4;
++ else if (length > 6)
++ val |= 3 << 4;
++ else if (length > 4)
++ val |= 2 << 4;
++ else if (length > 2)
++ val |= 1 << 4;
++
++ /* Enable keyclick */
++ val |= 0x8000;
++
++ tsc2102_write_sync(TSC2102_AUDIO2_CTRL, val);
++ spin_unlock(&tsc.lock_sync);
++}
++
++#ifdef CONFIG_HWMON
++#define TSC2102_INPUT(devname, field) \
++static ssize_t show_ ## devname(struct device *dev, \
++ struct device_attribute *devattr, char *buf) \
++{ \
++ struct tsc2102_dev *devhwmon = dev_get_drvdata(dev); \
++ int value = devhwmon->field; \
++ return sprintf(buf, "%i\n", value); \
++} \
++static DEVICE_ATTR(devname ## _input, S_IRUGO, show_ ## devname, NULL);
++
++TSC2102_INPUT(in0, bat[0])
++TSC2102_INPUT(in1, bat[1])
++TSC2102_INPUT(in2, aux[0])
++TSC2102_INPUT(in3, temp[0])
++TSC2102_INPUT(in4, temp[1])
++
++static ssize_t show_temp1(struct device *dev,
++ struct device_attribute *devattr, char *buf)
++{
++ struct tsc2102_dev *devhwmon = dev_get_drvdata(dev);
++ int t1, t2;
++ int value, diff;
++
++ t1 = devhwmon->temp[0];
++ t2 = devhwmon->temp[1];
++
++ /*
++ * Use method #2 (differential) to calculate current temperature.
++ * The difference between TEMP2 and TEMP1 input values is
++ * multiplied by a constant to obtain current temperature.
++ * To find this constant we use the values measured at 25 C as
++ * thermometer calibration data.
++ *
++ * 298150 is 25 degrees Celcius represented in Kelvins and
++ * multiplied by 1000 for fixed point precision (273.15 + 25).
++ * 273150 is zero degrees Celcius.
++ */
++ diff = devhwmon->pdata->temp_at25c[1] - devhwmon->pdata->temp_at25c[0];
++ BUG_ON(diff == 0);
++ value = (t2 - t1) * 298150 / diff; /* This is in Kelvins now */
++
++ t1 = value - 273150; /* Celcius millidegree */
++ return sprintf(buf, "%i\n", t1);
++}
++static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1, NULL);
++#endif /* CONFIG_HWMON */
++
++#ifdef CONFIG_APM
++static void tsc2102_get_power_status(struct apm_power_info *info)
++{
++ tsc.pdata->apm_report(info, tsc.bat);
++}
++#endif
++
++#ifdef CONFIG_PM
++/*
++ * Suspend the chip.
++ */
++static int
++tsc2102_suspend(struct spi_device *spi, pm_message_t state)
++{
++ struct tsc2102_dev *dev = dev_get_drvdata(&spi->dev);
++
++ if (!dev)
++ return 0;
++
++ spin_lock(&dev->lock_sync);
++
++ del_timer(&dev->mode_timer);
++ del_timer(&dev->ts_timer);
++
++ if (dev->pendown && dev->touch_cb)
++ dev->touch_cb(0);
++
++ /* Abort current conversion and power down the ADC */
++ tsc2102_write_sync(TSC2102_TS_ADC_CTRL, TSC2102_ADC_ADST);
++
++ dev->spi->dev.power.power_state = state;
++
++ spin_unlock(&dev->lock_sync);
++ return 0;
++}
++
++/*
++ * Resume chip operation.
++ */
++static int tsc2102_resume(struct spi_device *spi)
++{
++ struct tsc2102_dev *dev = dev_get_drvdata(&spi->dev);
++ int err;
++
++ if (!dev)
++ return 0;
++
++ spin_lock(&dev->lock_sync);
++
++ dev->spi->dev.power.power_state = PMSG_ON;
++
++ dev->state = 0;
++ dev->pendown = 0;
++
++ err = tsc2102_configure(dev);
++
++ spin_unlock(&dev->lock_sync);
++ return err;
++}
++#else
++#define tsc2102_suspend NULL
++#define tsc2102_resume NULL
++#endif
++
++static struct platform_device tsc2102_ts_device = {
++ .name = "tsc2102-ts",
++ .id = -1,
++};
++
++static struct platform_device tsc2102_alsa_device = {
++ .name = "tsc2102-alsa",
++ .id = -1,
++};
++
++static int tsc2102_probe(struct spi_device *spi)
++{
++ struct tsc2102_config *pdata = spi->dev.platform_data;
++ struct spi_transfer *spi_buffer;
++ int err = 0;
++
++ if (!pdata) {
++ printk(KERN_ERR "TSC2102: Platform data not supplied\n");
++ return -ENOENT;
++ }
++
++ if (!spi->irq) {
++ printk(KERN_ERR "TSC2102: Invalid irq value\n");
++ return -ENOENT;
++ }
++
++ tsc.pdata = pdata;
++ tsc.state = 0;
++ tsc.pendown = 0;
++ tsc.data_pending = 0;
++ tsc.ts_msecs = 20;
++ tsc.mode_msecs = 1000;
++ tsc.spi = spi;
++
++ /* Allocate enough struct spi_transfer's for all requests */
++ spi_buffer = kzalloc(sizeof(struct spi_transfer) * 16, GFP_KERNEL);
++ if (!spi_buffer) {
++ printk(KERN_ERR "TSC2102: No memory for SPI buffers\n");
++ return -ENOMEM;
++ }
++
++ tsc.transfers = spi_buffer;
++ tsc2102_request_alloc(&tsc, &tsc.req_adc, 0, 4, &spi_buffer);
++ tsc2102_request_alloc(&tsc, &tsc.req_status, 0, 1, &spi_buffer);
++ tsc2102_request_alloc(&tsc, &tsc.req_pressure, 0, 1, &spi_buffer);
++ tsc2102_request_alloc(&tsc, &tsc.req_stopadc, 1, 1, &spi_buffer);
++ tsc2102_request_alloc(&tsc, &tsc.req_mode, 1, 1, &spi_buffer);
++
++ spin_lock_init(&tsc.lock);
++ spin_lock(&tsc.lock_sync);
++
++ /* Get the BCLK - assuming the rate is at 12000000 */
++ tsc.bclk_ck = clk_get(0, "bclk");
++ if (!tsc.bclk_ck) {
++ printk(KERN_ERR "Unable to get the clock BCLK\n");
++ err = -EPERM;
++ goto done;
++ }
++
++ clk_enable(tsc.bclk_ck);
++
++ if (request_irq(spi->irq, tsc2102_handler, IRQF_SAMPLE_RANDOM |
++ IRQF_TRIGGER_FALLING, "tsc2102", &tsc)) {
++ printk(KERN_ERR "Could not allocate touchscreen IRQ!\n");
++ err = -EINVAL;
++ goto err_clk;
++ }
++
++ setup_timer(&tsc.ts_timer,
++ tsc2102_pressure, (unsigned long) &tsc);
++ setup_timer(&tsc.mode_timer,
++ tsc2102_mode_timer, (unsigned long) &tsc);
++
++ /* Set up the communication bus */
++ dev_set_drvdata(&spi->dev, &tsc);
++ spi->dev.power.power_state = PMSG_ON;
++ spi->mode = SPI_MODE_1;
++ spi->bits_per_word = 16;
++ err = spi_setup(spi);
++ if (err)
++ goto err_timer;
++
++ /* Now try to detect the chip, make first contact */
++ if (tsc2102_get_revision() != 0x1) {
++ printk(KERN_ERR "No TI TSC2102 chip found!\n");
++ goto err_timer;
++ }
++
++ err = tsc2102_configure(&tsc);
++ if (err)
++ goto err_timer;
++
++ /* Register devices controlled by TSC 2102 */
++ tsc2102_ts_device.dev.platform_data = pdata;
++ tsc2102_ts_device.dev.parent = &spi->dev;
++ err = platform_device_register(&tsc2102_ts_device);
++ if (err)
++ goto err_timer;
++
++ tsc2102_alsa_device.dev.platform_data = pdata->alsa_config;
++ tsc2102_alsa_device.dev.parent = &spi->dev;
++ err = platform_device_register(&tsc2102_alsa_device);
++ if (err)
++ goto err_ts;
++
++#ifdef CONFIG_HWMON
++ tsc.hwmondev = hwmon_device_register(&spi->dev);
++ if (IS_ERR(tsc.hwmondev)) {
++ printk(KERN_ERR "tsc2102_hwmon: Device registration failed\n");
++ err = PTR_ERR(tsc.hwmondev);
++ goto err_alsa;
++ }
++
++ if (pdata->monitor & TSC_BAT1)
++ err |= device_create_file(&spi->dev, &dev_attr_in0_input);
++ if (pdata->monitor & TSC_BAT2)
++ err |= device_create_file(&spi->dev, &dev_attr_in1_input);
++ if (pdata->monitor & TSC_AUX)
++ err |= device_create_file(&spi->dev, &dev_attr_in2_input);
++ if (pdata->monitor & TSC_TEMP) {
++ err |= device_create_file(&spi->dev, &dev_attr_temp1_input);
++ err |= device_create_file(&spi->dev, &dev_attr_in3_input);
++ err |= device_create_file(&spi->dev, &dev_attr_in4_input);
++ }
++
++ if (err)
++ printk(KERN_ERR "tsc2102_hwmon: Creating one or more "
++ "attribute files failed\n");
++ err = 0; /* Not fatal */
++#endif
++
++#ifdef CONFIG_APM
++ if (pdata->apm_report)
++ apm_get_power_status = tsc2102_get_power_status;
++#endif
++
++ if (!err)
++ goto done;
++
++err_alsa:
++ platform_device_unregister(&tsc2102_alsa_device);
++err_ts:
++ platform_device_unregister(&tsc2102_ts_device);
++err_timer:
++ del_timer(&tsc.ts_timer);
++ del_timer(&tsc.mode_timer);
++ dev_set_drvdata(&spi->dev, NULL);
++err_clk:
++ clk_disable(tsc.bclk_ck);
++ clk_put(tsc.bclk_ck);
++done:
++ spin_unlock(&tsc.lock_sync);
++ return err;
++}
++
++static int tsc2102_remove(struct spi_device *spi)
++{
++ struct tsc2102_dev *dev = dev_get_drvdata(&spi->dev);
++
++ spin_lock(&dev->lock_sync);
++
++ platform_device_unregister(&tsc2102_ts_device);
++ platform_device_unregister(&tsc2102_alsa_device);
++
++ dev_set_drvdata(&spi->dev, NULL);
++
++ /* Release the BCLK */
++ clk_disable(dev->bclk_ck);
++ clk_put(dev->bclk_ck);
++
++ del_timer(&tsc.mode_timer);
++ del_timer(&tsc.ts_timer);
++
++ kfree(tsc.transfers);
++
++#ifdef CONFIG_HWMON
++ hwmon_device_unregister(dev->hwmondev);
++#endif
++
++#ifdef CONFIG_APM
++ apm_get_power_status = 0;
++#endif
++
++ spin_unlock(&dev->lock_sync);
++
++ return 0;
++}
++
++static struct spi_driver tsc2102_driver = {
++ .probe = tsc2102_probe,
++ .remove = tsc2102_remove,
++ .suspend = tsc2102_suspend,
++ .resume = tsc2102_resume,
++ .driver = {
++ .name = "tsc2102",
++ .owner = THIS_MODULE,
++ .bus = &spi_bus_type,
++ },
++};
++
++static char __initdata banner[] = KERN_INFO "TI TSC2102 driver initializing\n";
++
++static int __init tsc2102_init(void)
++{
++ printk(banner);
++ return spi_register_driver(&tsc2102_driver);
++}
++
++static void __exit tsc2102_exit(void)
++{
++ spi_unregister_driver(&tsc2102_driver);
++}
++
++module_init(tsc2102_init);
++module_exit(tsc2102_exit);
++
++EXPORT_SYMBOL(tsc2102_read_sync);
++EXPORT_SYMBOL(tsc2102_reads_sync);
++EXPORT_SYMBOL(tsc2102_write_sync);
++EXPORT_SYMBOL(tsc2102_keyclick);
++
++MODULE_AUTHOR("Andrzej Zaborowski");
++MODULE_DESCRIPTION("Interface driver for TI TSC2102 chips.");
++MODULE_LICENSE("GPL");
+--- /dev/null
++++ b/include/linux/spi/tsc2102.h
+@@ -0,0 +1,175 @@
++/*
++ * include/linux/spi/tsc2102.h
++ *
++ * TI TSC2102 Touchscreen, Audio and Battery control register definitions
++ *
++ * Copyright (c) 2005 Andrzej Zaborowski <ba...@za...>
++ *
++ * This package is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This package is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this package; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++#ifndef __LINUX_SPI_TSC2102_H
++#define __LINUX_SPI_TSC2102_H
++
++struct apm_power_info;
++struct tsc2102_config {
++ int use_internal; /* Use internal reference voltage */
++ uint32_t monitor; /* What inputs are relevant */
++ int temp_at25c[2]; /* Thermometer calibration data */
++ void (*apm_report)(struct apm_power_info *info, int *battery);
++ /* Report status to APM based on battery[] */
++ void *alsa_config; /* .platform_data for the ALSA device */
++};
++
++#define TSC_BAT1 (1 << 0)
++#define TSC_BAT2 (1 << 1)
++#define TSC_AUX (1 << 2)
++#define TSC_TEMP (1 << 4)
++
++extern u16 tsc2102_read_sync(int page, u8 address);
++extern void tsc2102_reads_sync(int page, u8 startaddress, u16 *data,
++ int numregs);
++extern void tsc2102_write_sync(int page, u8 address, u16 data);
++
++typedef void (*tsc2102_touch_t)(int touching);
++typedef void (*tsc2102_coords_t)(int x, int y, int z1, int z2);
++typedef void (*tsc2102_ports_t)(int bat1, int bat2, int aux);
++typedef void (*tsc2102_temp_t)(int temp);
++extern int tsc2102_touch_cb(tsc2102_touch_t handler);
++extern int tsc2102_coords_cb(tsc2102_coords_t handler);
++extern int tsc2102_ports_cb(tsc2102_ports_t handler);
++extern int tsc2102_temp1_cb(tsc2102_temp_t handler);
++extern int tsc2102_temp2_cb(tsc2102_temp_t handler);
++
++#ifdef CONFIG_SOUND
++extern void tsc2102_set_volume(uint8_t left_ch, uint8_t right_ch);
++extern void tsc2102_set_mute(int left_ch, int right_ch);
++extern void tsc2102_get_mute(int *left_ch, int *right_ch);
++extern void tsc2102_dac_power(int state);
++extern int tsc2102_set_rate(int rate);
++extern void tsc2102_set_i2s_master(int state);
++extern void tsc2102_set_deemphasis(int enable);
++extern void tsc2102_set_bassboost(int enable);
++#endif
++
++extern void tsc2102_keyclick(int amplitude, int freq, int length);
++
++#define TSC2102_REG(pg, addr) pg, addr
++
++/* Page 0, Touch Screen & Keypad Data registers */
++#define TSC2102_TS_X TSC2102_REG(0, 0x00)
++#define TSC2102_TS_Y TSC2102_REG(0, 0x01)
++#define TSC2102_TS_Z1 TSC2102_REG(0, 0x02)
++#define TSC2102_TS_Z2 TSC2102_REG(0, 0x03)
++#define TSC2102_TS_BAT1 TSC2102_REG(0, 0x05)
++#define TSC2102_TS_BAT2 TSC2102_REG(0, 0x06)
++#define TSC2102_TS_AUX TSC2102_REG(0, 0x07)
++#define TSC2102_TS_TEMP1 TSC2102_REG(0, 0x09)
++#define TSC2102_TS_TEMP2 TSC2102_REG(0, 0x0a)
++
++/* Page 1, Touch Screen & Keypad Control registers */
++#define TSC2102_TS_ADC_CTRL TSC2102_REG(1, 0x00)
++#define TSC2102_TS_STATUS_CTRL TSC2102_REG(1, 0x01)
++#define TSC2102_TS_REF_CTRL TSC2102_REG(1, 0x03)
++#define TSC2102_TS_RESET_CTRL TSC2102_REG(1, 0x04)
++#define TSC2102_TS_CONFIG_CTRL TSC2102_REG(1, 0x05)
++
++/* Page 2, Audio Control registers */
++#define TSC2102_AUDIO1_CTRL TSC2102_REG(2, 0x00)
++#define TSC2102_DAC_GAIN_CTRL TSC2102_REG(2, 0x02)
++#define TSC2102_AUDIO2_CTRL TSC2102_REG(2, 0x04)
++#define TSC2102_DAC_POWER_CTRL TSC2102_REG(2, 0x05)
++#define TSC2102_AUDIO3_CTRL TSC2102_REG(2, 0x06)
++#define TSC2102_LCH_BASS_BOOST_N0 TSC2102_REG(2, 0x07)
++#define TSC2102_LCH_BASS_BOOST_N1 TSC2102_REG(2, 0x08)
++#define TSC2102_LCH_BASS_BOOST_N2 TSC2102_REG(2, 0x09)
++#define TSC2102_LCH_BASS_BOOST_N3 TSC2102_REG(2, 0x0a)
++#define TSC2102_LCH_BASS_BOOST_N4 TSC2102_REG(2, 0x0b)
++#define TSC2102_LCH_BASS_BOOST_N5 TSC2102_REG(2, 0x0c)
++#define TSC2102_LCH_BASS_BOOST_D1 TSC2102_REG(2, 0x0d)
++#define TSC2102_LCH_BASS_BOOST_D2 TSC2102_REG(2, 0x0e)
++#define TSC2102_LCH_BASS_BOOST_D4 TSC2102_REG(2, 0x0f)
++#define TSC2102_LCH_BASS_BOOST_D5 TSC2102_REG(2, 0x10)
++#define TSC2102_RCH_BASS_BOOST_N0 TSC2102_REG(2, 0x11)
++#define TSC2102_RCH_BASS_BOOST_N1 TSC2102_REG(2, 0x12)
++#define TSC2102_RCH_BASS_BOOST_N2 TSC2102_REG(2, 0x13)
++#define TSC2102_RCH_BASS_BOOST_N3 TSC2102_REG(2, 0x14)
++#define TSC2102_RCH_BASS_BOOST_N4 TSC2102_REG(2, 0x15)
++#define TSC2102_RCH_BASS_BOOST_N5 TSC2102_REG(2, 0x16)
++#define TSC2102_RCH_BASS_BOOST_D1 TSC2102_REG(2, 0x17)
++#define TSC2102_RCH_BASS_BOOST_D2 TSC2102_REG(2, 0x18)
++#define TSC2102_RCH_BASS_BOOST_D4 TSC2102_REG(2, 0x19)
++#define TSC2102_RCH_BASS_BOOST_D5 TSC2102_REG(2, 0x1a)
++#define TSC2102_PLL1_CTRL TSC2102_REG(2, 0x1b)
++#define TSC2102_PLL2_CTRL TSC2102_REG(2, 0x1c)
++#define TSC2102_AUDIO4_CTRL TSC2102_REG(2, 0x1d)
++
++/* Field masks for Audio Control 1 */
++#define AC1_WLEN(ARG) (((ARG) & 0x03) << 10)
++#define AC1_DATFM(ARG) (((ARG) & 0x03) << 8)
++#define AC1_DACFS(ARG) ((ARG) & 0x3f)
++
++/* Field masks for TSC2102_DAC_GAIN_CTRL */
++#define DGC_DALMU (1 << 15)
++#define DGC_DALVL(ARG) (((ARG) & 0x7f) << 8)
++#define DGC_DARMU (1 << 7)
++#define DGC_DARVL(ARG) (((ARG) & 0x7f))
++
++/* Field formats for TSC2102_AUDIO2_CTRL */
++#define AC2_KCLEN (1 << 15)
++#define AC2_KCLAC(ARG) (((ARG) & 0x07) << 12)
++#define AC2_KCLFRQ(ARG) (((ARG) & 0x07) << 8)
++#define AC2_KCLLN(ARG) (((ARG) & 0x0f) << 4)
++#define AC2_DLGAF (1 << 3)
++#define AC2_DRGAF (1 << 2)
++#define AC2_DASTC (1 << 1)
++
++/* Field masks for TSC2102_DAC_POWER_CTRL */
++#define CPC_PWDNC (1 << 15)
++#define CPC_DAODRC (1 << 12)
++#define CPC_DAPWDN (1 << 10)
++#define CPC_VGPWDN (1 << 8)
++#define CPC_DAPWDF (1 << 6)
++#define CPC_BASSBC (1 << 1)
++#define CPC_DEEMPF (0x01)
++
++/* Field masks for TSC2101_AUDIO_CTRL_3 */
++#define AC3_DMSVOL(ARG) (((ARG) & 0x03) << 14)
++#define AC3_REFFS (1 << 13)
++#define AC3_DAXFM (1 << 12)
++#define AC3_SLVMS (1 << 11)
++#define AC3_DALOVF (1 << 7)
++#define AC3_DAROVF (1 << 6)
++#define AC3_REVID(ARG) (((ARG) & 0x07))
++
++/* Field masks for TSC2102_PLL1_CTRL */
++#define PLL1_PLLEN (1 << 15)
++#define PLL1_Q_VAL(ARG) (((ARG) & 0x0f) << 11)
++#define PLL1_P_VAL(ARG) (((ARG) & 0x07) << 8)
++#define PLL1_I_VAL(ARG) (((ARG) & 0x3f) << 2)
++
++/* Field masks for TSC2102_PLL2_CTRL */
++#define PLL2_D_VAL(ARG) (((ARG) & 0x3fff) << 2)
++
++/* Field masks for TSC2101_AUDIO_CTRL_4 */
++#define AC4_DASTPD (1 << 14)
++
++struct tsc2102_rate_info_s {
++ u16 sample_rate;
++ u8 divisor;
++ u8 fs_44k; /* 44.1 kHz Fsref if 1, 48 kHz if 0 */
++};
++
++#endif /* __LINUX_SPI_TSC2102_H */
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/074-linux-2.6.18-tsc2102-touchscreen.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/074-linux-2.6.18-tsc2102-touchscreen.diff (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/074-linux-2.6.18-tsc2102-touchscreen.diff 2007-07-14 15:29:41 UTC (rev 611)
@@ -0,0 +1,184 @@
+diff -pNaur -X b/Documentation/dontdiff a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
+--- a/drivers/input/touchscreen/Kconfig 2006-07-06 02:48:09.000000000 +0000
++++ b/drivers/input/touchscreen/Kconfig 2006-08-17 23:35:38.000000000 +0000
+@@ -111,6 +111,20 @@ config TOUCHSCREEN_HP600
+ To compile this driver as a module, choose M here: the
+ module will be called hp680_ts_input.
+
++config TOUCHSCREEN_TSC2102
++ tristate "TSC 2102 based touchscreens"
++ depends on SPI_MASTER
++ select SPI_TSC2102
++ help
++ Say Y here if you have a touchscreen interface using the
++ TI TSC 2102 controller, and your board-specific initialization
++ code includes that in its table of SPI devices.
++
++ If unsure, say N (but it's safe to say "Y").
++
++ To compile this driver as a module, choose M here: the
++ module will be called tsc2102_ts.
++
+ endif
+ config TOUCHSCREEN_OMAP
+ tristate "OMAP touchscreen input driver"
+diff -pNaur -X b/Documentation/dontdiff a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
+--- a/drivers/input/touchscreen/Makefile 2006-03-22 17:44:37.000000000 +0000
++++ b/drivers/input/touchscreen/Makefile 2006-08-17 23:35:38.000000000 +0000
+@@ -12,3 +12,4 @@ obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
+ obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
+ obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o
+ obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
++obj-$(CONFIG_TOUCHSCREEN_TSC2102) += tsc2102_ts.o
+diff -pNaur -X b/Documentation/dontdiff a/drivers/input/touchscreen/tsc2102_ts.c b/drivers/input/touchscreen/tsc2102_ts.c
+--- a/drivers/input/touchscreen/tsc2102_ts.c 1970-01-01 00:00:00.000000000 +0000
++++ b/drivers/input/touchscreen/tsc2102_ts.c 2006-08-17 23:35:38.000000000 +0000
+@@ -0,0 +1,148 @@
++/*
++ * input/touchscreen/tsc2102_ts.c
++ *
++ * Touchscreen input device driver for boards using the TSC 2102 chip.
++ *
++ * Copyright (c) 2006 Andrzej Zaborowski <ba...@za...>
++ *
++ * This package is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This package is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this package; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++#include <linux/errno.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/input.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/kbd_kern.h>
++
++#include <linux/spi/tsc2102.h>
++
++struct input_dev *dev;
++
++static void tsc2102_touch(int touching)
++{
++ if (!touching) {
++ input_report_abs(dev, ABS_X, 0);
++ input_report_abs(dev, ABS_Y, 0);
++ input_report_abs(dev, ABS_PRESSURE, 0);
++ input_sync(dev);
++ }
++
++ input_report_key(dev, BTN_TOUCH, touching);
++
++ do_poke_blanked_console = 1;
++}
++
++static void tsc2102_coords(int x, int y, int z1, int z2)
++{
++ int p;
++
++ /* Calculate the touch resistance a la equation #1 */
++ if (z1 != 0)
++ p = x * (z2 - z1) / (z1 << 4);
++ else
++ p = 1;
++
++ input_report_abs(dev, ABS_X, x);
++ input_report_abs(dev, ABS_Y, y);
++ input_report_abs(dev, ABS_PRESSURE, p);
++ input_sync(dev);
++}
++
++static int tsc2102_ts_probe(struct platform_device *pdev)
++{
++ int status;
++
++ dev = input_allocate_device();
++ if (!dev)
++ return -ENOMEM;
++
++ status = tsc2102_touch_cb(tsc2102_touch);
++ if (status) {
++ input_free_device(dev);
++ return status;
++ }
++
++ status = tsc2102_coords_cb(tsc2102_coords);
++ if (status) {
++ input_free_device(dev);
++ return status;
++ }
++
++ dev->name = "TSC2102 Touchscreen";
++ dev->dev = &pdev->dev;
++ dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
++ dev->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
++ dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
++ input_register_device(dev);
++
++ printk("TSC2102 touchscreen driver initialized\n");
++ return 0;
++}
++
++static int tsc2102_ts_remove(struct platform_device *pdev)
++{
++ tsc2102_touch_cb(0);
++ tsc2102_coords_cb(0);
++ input_unregister_device(dev);
++ return 0;
++}
++
++static int
++tsc2102_ts_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ /* Nothing yet */
++ return 0;
++}
++
++static int tsc2102_ts_resume(struct platform_device *pdev)
++{
++ /* Nothing either */
++ return 0;
++}
++
++static struct platform_driver tsc2102_ts_driver = {
++ .probe = tsc2102_ts_probe,
++ .remove = tsc2102_ts_remove,
++ .suspend = tsc2102_ts_suspend,
++ .resume = tsc2102_ts_resume,
++ .driver = {
++ .name = "tsc2102-ts",
++ },
++};
++
++static int __init tsc2102_ts_init(void)
++{
++ int ret;
++
++ ret = platform_driver_register(&tsc2102_ts_driver);
++ if (ret)
++ return -ENODEV;
++
++ return 0;
++}
++
++static void __exit tsc2102_ts_exit(void)
++{
++ platform_driver_unregister(&tsc2102_ts_driver);
++}
++
++module_init(tsc2102_ts_init);
++module_exit(tsc2102_ts_exit);
++
++MODULE_AUTHOR("Andrzej Zaborowski");
++MODULE_DESCRIPTION("Touchscreen input driver for TI TSC2102.");
++MODULE_LICENSE("GPL");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-07-02 16:53:34
|
Revision: 610
http://armadeus.svn.sourceforge.net/armadeus/?rev=610&view=rev
Author: artemys
Date: 2007-07-02 09:53:36 -0700 (Mon, 02 Jul 2007)
Log Message:
-----------
[PACKAGE] Add demos compilation when building mesa
Modified Paths:
--------------
trunk/buildroot/package/mesa/mesa.patch
Modified: trunk/buildroot/package/mesa/mesa.patch
===================================================================
--- trunk/buildroot/package/mesa/mesa.patch 2007-06-30 09:22:49 UTC (rev 609)
+++ trunk/buildroot/package/mesa/mesa.patch 2007-07-02 16:53:36 UTC (rev 610)
@@ -165,3 +165,24 @@
install: default
+--- Mesa-7.0.org/configs/linux-fbdev 2007-06-22 00:10:53.000000000 +0200
++++ Mesa-7.0/configs/linux-fbdev 2007-06-29 19:13:04.000000000 +0200
+@@ -4,13 +4,14 @@
+
+ CONFIG_NAME = linux-fbdev
+
+-CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER
++CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER -I$(TOP)/../staging_dir/usr/include -I$(TOP)/../staging_dir/include -Wl,-rpath-link,$(TOP)/../staging_dir/usr/lib
+
+ SRC_DIRS = mesa glu glut/fbdev
+ DRIVER_DIRS = fbdev osmesa
+-PROGRAM_DIRS = fbdev demos redbook samples
++PROGRAM_DIRS = fbdev demos osdemos redbook samples
+
+ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread
+-OSMESA_LIB_DEPS = -lm -lpthread
+-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
++OSMESA_LIB_DEPS = -lm -lpthread -L$(TOP)/../staging_dir/usr/lib
++GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L$(TOP)/../staging_dir/usr/lib -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
++APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L$(TOP)/../staging_dir/usr/lib -l$(GLU_LIB) -l$(GL_LIB) -l$(GLUT_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <th...@us...> - 2007-06-30 09:22:47
|
Revision: 609
http://armadeus.svn.sourceforge.net/armadeus/?rev=609&view=rev
Author: thom25
Date: 2007-06-30 02:22:49 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
add initial version of orchestra project builder
Added Paths:
-----------
trunk/software/orchesta/
trunk/software/orchesta/armadeus_ready/
trunk/software/orchesta/common/
trunk/software/orchesta/common/armadeus_ready.cpp
trunk/software/orchesta/common/armadeus_ready.h
trunk/software/orchesta/common/ip.cpp
trunk/software/orchesta/common/ip.h
trunk/software/orchesta/common/line_option.cpp
trunk/software/orchesta/common/line_option.h
trunk/software/orchesta/common/platform.cpp
trunk/software/orchesta/common/platform.h
trunk/software/orchesta/common/project.cpp
trunk/software/orchesta/common/project.h
trunk/software/orchesta/common/toolchain.cpp
trunk/software/orchesta/common/toolchain.h
trunk/software/orchesta/common/xmldoc.cpp
trunk/software/orchesta/common/xmldoc.h
trunk/software/orchesta/plateform.xml
trunk/software/orchesta/projectBuilder/
trunk/software/orchesta/projectBuilder/debug/
trunk/software/orchesta/projectBuilder/main.cpp
trunk/software/orchesta/projectBuilder/projectBuilder.pro
trunk/software/orchesta/xilinx_toolchain.xml
Added: trunk/software/orchesta/common/armadeus_ready.cpp
===================================================================
--- trunk/software/orchesta/common/armadeus_ready.cpp (rev 0)
+++ trunk/software/orchesta/common/armadeus_ready.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,82 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** armadeus_ready.cpp: armadeus_ready utilities
+**
+** author: th...@us...
+*/
+#include "armadeus_ready.h"
+
+#include <qdir>
+#include <qfileinfo>
+#include <qstringlist>
+
+void ArmadeusReadyIpFinder::getNextIpAbsoluteNames(QFileInfoList *ipNamesList, QDir dir){
+ QDir fileDir(dir.path()+"/");
+ fileDir.setFilter(QDir::Files | QDir::NoSymLinks);
+ fileDir.setNameFilters(QStringList("*.xml"));
+
+ // start with local files
+ QFileInfoList list = fileDir.entryInfoList();
+ for (int i = 0; i < list.size(); ++i) {
+ ipNamesList->append(list.at(i));
+ }
+ // continue with local folders
+ dir.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
+ list = dir.entryInfoList();
+ for ( int i = 0; i < list.size(); ++i) {
+ getNextIpAbsoluteNames(ipNamesList, QDir(list.at(i).absoluteFilePath()+"/") );
+ }
+}
+
+QString ArmadeusReadyIpFinder::getIpAbsoluteFilePath( QString fileName ){
+ QFileInfoList ipList = getAllIpAbsoluteNames();
+ for( int i = 0; i<ipList.size(); i++ ){
+ if( ipList.at(i).baseName() == fileName )
+ return ipList.at(i).absoluteFilePath();
+ }
+ return QString();
+}
+
+
+
+void ArmadeusReadyIpFinder::setPath( QString path ){
+ armadeusReadyPath = path;
+}
+
+QFileInfoList ArmadeusReadyIpFinder::getAllIpAbsoluteNames(){
+ QFileInfoList result;
+ QDir dir(armadeusReadyPath);
+
+ dir.setFilter(QDir::AllDirs);
+ getNextIpAbsoluteNames(&result, dir);
+
+ return result;
+
+}
+
+QStringList ArmadeusReadyIpFinder::getAllIpNames(){
+ QStringList result;
+ QFileInfoList ipList = getAllIpAbsoluteNames();
+ for( int i = 0; i<ipList.size(); i++ ){
+ result.append(ipList.at(i).baseName());
+ }
+
+ return result;
+}
Added: trunk/software/orchesta/common/armadeus_ready.h
===================================================================
--- trunk/software/orchesta/common/armadeus_ready.h (rev 0)
+++ trunk/software/orchesta/common/armadeus_ready.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,50 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** armadeus_ready.h: armadeus_ready utilities
+**
+** author: th...@us...
+*/
+#ifndef ARMADEUS_READY_H
+#define ARMADEUS_READY_H
+
+#include <qstring>
+#include <qdir>
+
+#define ARMADEUS_READY_FOLDER "/armadeus_ready/"
+
+class ArmadeusReadyIpFinder
+{
+ protected:
+ QString armadeusReadyPath;
+
+ void getNextIpAbsoluteNames(QFileInfoList *ipNamesList, QDir dir);
+ QFileInfoList getAllIpAbsoluteNames();
+
+ public:
+ ArmadeusReadyIpFinder(){};
+ virtual ~ArmadeusReadyIpFinder(){};
+
+ virtual void setPath(QString path);
+ virtual QStringList getAllIpNames();
+ virtual QString getIpAbsoluteFilePath( QString fileName );
+};
+
+
+#endif //ARMADEUS_READY_H
Added: trunk/software/orchesta/common/ip.cpp
===================================================================
--- trunk/software/orchesta/common/ip.cpp (rev 0)
+++ trunk/software/orchesta/common/ip.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,137 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** ip.cpp: FGPA ip wrapper
+**
+** author: th...@us...
+*/
+#include <qstringlist>
+#include <qfile>
+#include <qdomdocument>
+#include <qbytearray>
+#include <qtextstream>
+#include <qregexpvalidator>
+#include "ip.h"
+
+AddressRange::AddressRange():top(0),bottom(0){};
+AddressRange::AddressRange(int byteSize):top(0), bottom(byteSize-1){};
+AddressRange::AddressRange(int start, int length):top(start), bottom(start+length-1){};
+
+void AddressRange::adjustStartAddress(int address){ top += address; bottom += address; }
+void AddressRange::adjustEndAddress(int address){ bottom += address; }
+
+void AddressRange::merge(AddressRange range){
+// printf("address Range: %d, %d\n", range.start(), range.end());
+ if( range.end() > bottom )
+ bottom = range.end();
+ if( range.start() < top )
+ top = range.start();
+}
+bool AddressRange::intersects(AddressRange range){
+ if( (range.start() >= top) || (range.end() <= bottom) )
+ return true;
+ return false;
+}
+int AddressRange::start(){ return top; }
+int AddressRange::end(){ return bottom; }
+
+
+
+
+bool Ip::setGenericAttributeValue(QString genericName, QString attributeName, QString attributeValue)
+{
+ QString filterString = getAttribute("generics", genericName, "valid");
+ if( filterString != "" ){ // if filter present
+ int pos=0;
+ QRegExpValidator validator(QRegExp(filterString), NULL);
+ if( validator.validate(attributeValue, pos) == QValidator::Acceptable ){
+ setAttributeValue("generics", genericName, attributeName, attributeValue);
+ return true;
+ }
+ }
+ else {
+ return setAttributeValue("generics", genericName, attributeName, attributeValue);
+ }
+ return false;
+}
+
+QString Ip::getHDLTopName(){
+ QDomElement hdls = xmlNode.firstChildElement("hdl_files");
+ QDomNodeList hdlList = hdls.childNodes();
+ for( int i =0; i<hdlList.size(); i++ ){
+ if( hdlList.at(i).toElement().attribute("istop") == "1" )
+ return hdlList.at(i).toElement().attribute("name");
+ }
+ return QString();
+}
+
+
+QStringList Ip::getNameList(QString nodeName){
+ QStringList result;
+ QDomElement generics = xmlNode.firstChildElement(nodeName);
+ QDomNodeList genericList = generics.childNodes();
+ for( int i =0; i<genericList.size(); i++ ){
+ if( genericList.at(i).isElement() ) // avoid non Element
+ result += genericList.at(i).toElement().attribute("name");
+ }
+ return result;
+}
+
+QString Ip::getBaseAddress(){
+ return xmlNode.firstChildElement("base_address").attribute("value");
+}
+
+void Ip::setBaseAddress(QString address){
+ QDomElement base_address = xmlNode.firstChildElement("base_address");
+ base_address.setAttribute("value",address);
+}
+
+QString Ip::getInterrupt(){
+ return xmlNode.firstChildElement("interrupt").attribute("value");
+}
+
+void Ip::setInterrupt(QString interrupt){
+ QDomElement interruptElement = xmlNode.firstChildElement("interrupt");
+ interruptElement.setAttribute("value",interrupt);
+}
+
+
+
+AddressRange Ip::getRegisterAddressRange(){
+ AddressRange range;
+ QStringList registerNameList = getRegistersNameList();
+ for( int i=0; i<registerNameList.count(); i++ ){
+ QString offset = getRegisterAttribute(registerNameList.at(i), "offset");
+ QString width = getRegisterAttribute(registerNameList.at(i), "width");
+ bool ok;
+
+ if( width.toInt() )
+ range.merge(AddressRange(offset.remove("0X").toInt(&ok,16),width.toInt()/8));
+ }
+ if( getBaseAddress() != "" ){
+ range.adjustStartAddress(getBaseAddress().toInt());
+ }
+// printf("address Range: %d, %d\n", range.start(), range.end());
+ return range;
+}
+
+bool Ip::isRegisterAddressConflict(QString registerAddress){
+ return getRegisterAddressRange().intersects(AddressRange(registerAddress.toInt()));
+}
+
Added: trunk/software/orchesta/common/ip.h
===================================================================
--- trunk/software/orchesta/common/ip.h (rev 0)
+++ trunk/software/orchesta/common/ip.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,144 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** ip.h: FGPA ip wrapper
+**
+** author: th...@us...
+*/
+#ifndef IP_H
+#define IP_H
+
+#include <qstringList>
+#include <qrect>
+#include "xmldoc.h"
+
+class AddressRange
+{
+ protected:
+ int top;
+ int bottom;
+
+ public:
+ AddressRange();
+ AddressRange(int byteSize);
+ AddressRange(int start, int length);
+ virtual ~AddressRange(){};
+
+ virtual void adjustStartAddress( int address );
+ virtual void adjustEndAddress( int address );
+ virtual void merge( AddressRange range );
+ virtual bool intersects( AddressRange range );
+ virtual int start();
+ virtual int end();
+};
+
+
+
+
+
+
+class Ip : public XMLNodeWrapper
+{
+ protected:
+
+ QStringList getNameList(QString nodeName);
+
+ public:
+ Ip():XMLNodeWrapper(){};
+ virtual ~Ip(){};
+
+ QString getReference() {return xmlNode.toElement().attribute("name");};
+ QString getDescription() {return getCDATA("description");};
+ QString getVersion() {return xmlNode.toElement().attribute("version");};
+ QString getName() { return xmlNode.toElement().attribute("user_name");};
+
+ QString getGenericAttribute(QString genericName, QString attributeName)
+ {return getAttribute("generics", genericName, attributeName);};
+ bool setGenericAttributeValue(QString genericName, QString attribute, QString attributeValue);
+ QStringList getGenericNameList() {return getNameList("generics");};
+
+ QStringList getRegistersNameList() {return getNameList("registers");};
+ QString getRegisterAttribute(QString registerName, QString attributeName)
+ {return getAttribute("registers", registerName, attributeName);};
+
+ QString getHDLAttribute(QString HDLName, QString attributeName)
+ {return getAttribute("hdl_files",HDLName, attributeName);};
+ QStringList getHDLNameList() {return getNameList("hdl_files");};
+ QString getHDLTopName();
+
+ QString getBaseAddress();
+ void setBaseAddress(QString address);
+ QString getInterrupt();
+ void setInterrupt(QString interrupt);
+
+ bool isRegisterAddressConflict(QString registerAddress);
+ AddressRange getRegisterAddressRange();
+
+};
+
+#endif // IP_H
+/*
+
+
+
+
+class Ip : public XMLDoc
+{
+ protected:
+ QStringList getNameList(QString nodeName);
+// virtual QString getAttribute(QString startNodeName, QString nodeName, QString attributeName);
+ QDomNode getGenericsNode(){return getTopNode().firstChildElement("generics");}
+ QDomNode getHDLsNode(){return getTopNode().firstChildElement("hdl_files");}
+ QDomNode getRegistersNode(){return getTopNode().firstChildElement("registers");}
+
+ public:
+ Ip();
+ virtual ~Ip();
+
+ QString getReference() {return getAttribute(QDomNode(), QString("ip"), QString("ref"));};
+ QString getDescription() {return getCDATA(doc.documentElement(), "description");};
+ QString getVersion() {return getAttribute(QDomNode(), "ip", "version");};
+ QString getName() {return getAttribute(QDomNode(), "ip", "name");};
+
+ QString getGenericAttribute(QString genericName, QString attributeName)
+ {return getAttribute(getGenericsNode(), genericName, attributeName);};
+ bool setGenericAttributeValue(QString genericName, QString attribute, QString attributeValue);
+ QStringList getGenericNameList() {return getNameList("generics");};
+
+ QStringList getRegistersNameList() {return getNameList("registers");};
+ QString getRegisterAttribute(QString registerName, QString attributeName)
+ {return getAttribute(getRegistersNode(), registerName, attributeName);};
+
+ QString getHDLAttribute(QString HDLName, QString attributeName)
+ {return getAttribute(getHDLsNode(), HDLName, attributeName);};
+ QStringList getHDLNameList() {return getNameList("hdl_files");};
+ QString getHDLTopName();
+
+ QString getBaseAddress();
+ void setBaseAddress(QString address);
+
+ bool isRegisterAddressConflict(QString registerAddress);
+ AddressRange getRegisterAddressRange();
+
+ virtual bool initialize(QString aFileName, QString anIpName); // initialize the ip object with the informations contained in the xml file
+ virtual bool initialize(QDomNode *ipNode){ return XMLDoc::initialize(ipNode); };
+};
+
+#endif // IP_H
+*/
Added: trunk/software/orchesta/common/line_option.cpp
===================================================================
--- trunk/software/orchesta/common/line_option.cpp (rev 0)
+++ trunk/software/orchesta/common/line_option.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,99 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** line_option.cpp: command line option parser
+**
+** author: th...@us...
+*/
+#include <QString>
+#include <QStringList>
+
+#include "line_option.h"
+
+LineOption::LineOption( QString opt, QString help, OptionCallback aCallback ) {
+ option = opt; verbose = help;
+ nbArgs = help.count('[');
+ optionCallback = aCallback;
+};
+
+bool LineOption::process(QStringList list) {
+ QStringList argsList;
+ if( (!list.isEmpty()) && (list.at(0) == option) ) {
+ list.removeFirst();
+ if( list.size() == nbArgs ) {
+ optionCallback(list);
+ return true;
+ }
+ }
+ return false;
+};
+
+QString LineOption::getHelp() {
+ return verbose;
+};
+
+LineOptionManager::LineOptionManager(QString aMenu){
+ menu = aMenu;
+}
+
+int LineOptionManager::getMaxCmdLength(){
+ int maxCmdLength = 0;
+ int pos = 0;
+ for( int i=0; i<optionList.size(); i++ ){
+ int tempMaxCmdLength = optionList.at(i)->getHelp().indexOf(' ');
+ if( (pos != -1) && (tempMaxCmdLength>maxCmdLength) ){
+ maxCmdLength = tempMaxCmdLength;
+ }
+ }
+ return maxCmdLength;
+}
+
+void LineOptionManager::formatCmd(QString *string, int maxLength){
+ int pos = string->indexOf(' ');
+ if( pos < maxLength ){
+ for( int i = pos; i<maxLength; i++)
+ string->insert(pos,' ');
+ }
+}
+
+void LineOptionManager::displayHelp(){
+ printf("%s\n",menu.toLatin1().constData());
+
+ QStringList helpList;
+ int maxCmdLength = getMaxCmdLength();
+
+ for( int i=0; i<optionList.size(); i++ ){
+ QString cmd = optionList.at(i)->getHelp();
+ formatCmd(&cmd,maxCmdLength);
+ printf("%s\n", cmd.toLatin1().constData());
+ }
+}
+
+void LineOptionManager::add(LineOption *opt){
+ optionList.append( opt );
+};
+
+void LineOptionManager::execute(QStringList args){
+ for( int i=0; i<optionList.size(); i++ ){
+ if( optionList.at(i)->process(args) ){
+ return;
+ }
+ }
+ displayHelp();
+}
Added: trunk/software/orchesta/common/line_option.h
===================================================================
--- trunk/software/orchesta/common/line_option.h (rev 0)
+++ trunk/software/orchesta/common/line_option.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,67 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** line_option.h: command line option parser
+**
+** author: th...@us...
+*/
+#ifndef LINE_OPTION_H
+#define LINE_OPTION_H
+#include <QString>
+#include <QStringList>
+
+typedef void (*OptionCallback)(QStringList);
+
+class LineOption
+{
+ protected:
+ QString option;
+ QString verbose;
+ OptionCallback optionCallback;
+ int nbArgs;
+
+ public:
+ LineOption(){};
+ LineOption( QString opt, QString help, OptionCallback aCallback );
+ ~LineOption(){};
+
+ bool process(QStringList list);
+ QString getHelp();
+};
+
+class LineOptionManager
+{
+ protected:
+ QString menu;
+ QList<LineOption*> optionList;
+
+ void displayHelp();
+ int getMaxCmdLength();
+ void formatCmd(QString *string, int maxLength);
+
+ public:
+ LineOptionManager(){};
+ LineOptionManager(QString aMenu);
+ ~LineOptionManager(){};
+
+ void add(LineOption *opt);
+ void execute(QStringList args);
+};
+
+#endif // LINE_OPTION_H
Added: trunk/software/orchesta/common/platform.cpp
===================================================================
--- trunk/software/orchesta/common/platform.cpp (rev 0)
+++ trunk/software/orchesta/common/platform.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,33 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** platform.cpp: FPGA platform wrapper
+**
+** author: th...@us...
+*/
+#include "platform.h"
+
+QString Platform::getFullFPGAType(){
+ QString result;
+
+ result = getFPGAType()+"-";
+ result += getFPGAPackage();
+ result += getFPGASpeed();
+ return result;
+}
Added: trunk/software/orchesta/common/platform.h
===================================================================
--- trunk/software/orchesta/common/platform.h (rev 0)
+++ trunk/software/orchesta/common/platform.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,44 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** platform.h: FPGA platform wrapper
+**
+** author: th...@us...
+*/
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#include "xmldoc.h"
+
+class Platform : public XMLNodeWrapper
+{
+ public:
+ Platform():XMLNodeWrapper(){};
+ virtual ~Platform(){};
+
+ QString getFPGAType() { return getAttribute("fpga", "type"); };
+ QString getFPGASpeed() { return getAttribute("fpga", "speed"); };
+ QString getFPGAPackage() { return getAttribute("fpga", "package"); };
+ QString getFPGAFamily() { return getAttribute("fpga", "family"); };
+ QString getBoardType() { return getAttribute("board", "type"); };
+ QString getDescription() { return getCDATA("description"); };
+ QString getFullFPGAType();
+};
+
+#endif //PLATFORM_H
Added: trunk/software/orchesta/common/project.cpp
===================================================================
--- trunk/software/orchesta/common/project.cpp (rev 0)
+++ trunk/software/orchesta/common/project.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,349 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** project.cpp: FPGA project manager
+**
+** author: th...@us...
+*/
+#include "project.h"
+#include "ip.h"
+#include "platform.h"
+#include <qfileinfo>
+#include <qtextstream>
+#include <qmap>
+#include <qcoreapplication>
+
+Project::Project(){
+ docFileName = "";
+}
+
+Project::~Project(){}
+
+QMap<QString, QString> Project::getProjectVariables(){
+ QMap<QString, QString> result;
+ Platform plt;
+ get(&plt);
+ result.insert("LT", "<"); // for <
+ result.insert("GT", ">"); // for >
+ result.insert("PROJECTNAME", getName());
+ result.insert("FPGAFULLTYPE", plt.getFullFPGAType());
+
+ return result;
+}
+
+QDomNode Project::findIpNode(QString anIpName) {
+ QDomNodeList nodeList = doc.documentElement().elementsByTagName("ip");
+ for( int i=0; i<nodeList.size(); i++ ){
+ QDomElement e = nodeList.at(i).toElement(); // try to convert the node to an element.
+ if(!e.isNull()) {
+ if( e.attribute("user_name") == anIpName ){
+ return nodeList.at(i);
+ }
+ }
+ }
+ return QDomNode();
+}
+
+QDomNode Project::findPlatformNode() {
+ QDomElement docElem = doc.documentElement();
+ QDomNodeList nodeList = docElem.elementsByTagName("platform");
+ if( !nodeList.isEmpty() )
+ return nodeList.at(0);
+ return QDomNode();
+}
+
+
+QDomNode Project::findToolchainNode() {
+ QDomElement docElem = doc.documentElement();
+ QDomNodeList nodeList = docElem.elementsByTagName("toolchain");
+ if( !nodeList.isEmpty() )
+ return nodeList.at(0);
+ return QDomNode();
+}
+
+bool Project::addIp(QString ipName, QString ipFileName) {
+ if( findIpNode(ipName).isNull() ){ // test whether the ipname already exists or not
+ QDomDocument tempDoc;
+ if( getDocFromXmlFile(ipFileName, &tempDoc) ){
+ QDomElement ipNode = tempDoc.documentElement();
+
+ QDomElement interrupt = tempDoc.createElement("interrupt");
+ interrupt.setAttribute("value","");
+ ipNode.appendChild(interrupt);
+ QDomElement base_address = tempDoc.createElement("base_address");
+ base_address.setAttribute("value","");
+ ipNode.appendChild(base_address);
+ ipNode.setAttribute("user_name",ipName);
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+
+ return true;
+ }
+ printf("unable to read Ip xml file\n");
+ return false;
+ }
+ printf("Ip already exists\n");
+ return false;
+}
+
+bool Project::removeIp(QString anIpName){
+ QDomNode node = findIpNode(anIpName);
+ if( !node.isNull() ){
+ QDomNode parent = node.parentNode();
+ if( !parent.isNull()){
+ parent.removeChild(node);
+ return true;
+ }
+ }
+ printf("no Ip found\n");
+ return false;
+}
+
+bool Project::removePlatform(){
+ QDomNode pltNode = findPlatformNode();
+ if( !pltNode.isNull() ){
+ if( !doc.documentElement().removeChild(pltNode).isNull() )
+ return true;
+ }
+ printf("no platform\n");
+ return false;
+}
+
+
+bool Project::create(QString aFileName){
+ docFileName = aFileName;
+ QDomElement root = doc.createElement("project");
+ doc.appendChild(root);
+ return true;
+}
+
+bool Project::initialize(QString aFileName){
+ docFileName = aFileName;
+ QFile file(docFileName);
+ if (!file.open(QIODevice::ReadOnly)){
+ printf("unable to open project file\n");
+ return false;
+ }
+ if (!doc.setContent(&file)) {
+ printf("unable to read project file\n");
+ return false;
+ }
+ file.close();
+ return true;
+}
+
+bool Project::addPlatform(QString platformFileName){
+ if( findPlatformNode().isNull() ){
+ QDomDocument tempDoc;
+ if( getDocFromXmlFile(platformFileName, &tempDoc) ){
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+ return true;
+ }
+ return false;
+ }
+ printf("platform already exists\n");
+ return false;
+}
+
+bool Project::addToolchain(QString toolchainTemplate){
+ QDomNode toolNode = findToolchainNode();
+ if( !toolNode.isNull() ){
+ if( doc.documentElement().removeChild(toolNode).isNull() )
+ return false;
+ }
+ QDomDocument tempDoc;
+ printf("%s\n",(QCoreApplication::applicationDirPath()+"/"+toolchainTemplate).toLatin1().constData());
+ if( getDocFromXmlFile(QCoreApplication::applicationDirPath()+"/"+toolchainTemplate, &tempDoc) ){
+ doc.documentElement().appendChild( doc.importNode( tempDoc.documentElement(), true ));
+ return true;
+ }
+ return false;
+}
+
+
+
+bool Project::getDocFromXmlFile(QString fileName, QDomDocument *tempDoc){
+ QFile tempFile(fileName);
+ if (!tempFile.open(QIODevice::ReadOnly)){
+ printf("unable to open xml file %s\n",fileName.toLatin1().constData());
+ return false;
+ }
+ if (!tempDoc->setContent(&tempFile)) {
+ printf("unable to set content of xml doc\n");
+ tempFile.close();
+ return false;
+ }
+ tempFile.close();
+ return true;
+}
+
+
+QString Project::getName(){
+ return QFileInfo(getFileName()).baseName();
+}
+
+QStringList Project::getIpNames(){
+ QStringList result;
+
+ QDomNodeList nodeList = doc.documentElement().elementsByTagName("ip");
+ for( int i=0; i<nodeList.size(); i++ ){
+ QDomElement e = nodeList.at(i).toElement(); // try to convert the node to an element.
+ if(!e.isNull())
+ result.append(e.attribute("user_name"));
+ }
+ return result;
+}
+
+bool Project::get(Toolchain *result){
+ QDomNode node = findToolchainNode();
+ if( !node.isNull() ){
+ result->initialize(node, this);
+ return true;
+ }
+ return false;
+}
+
+bool Project::get(Platform *result){
+ QDomNode node = findPlatformNode();
+ if( !node.isNull() ){
+ result->initialize(node);
+ return true;
+ }
+ return false;
+}
+
+bool Project::get(QString anIpName, Ip *result){
+ QDomNode node = findIpNode(anIpName);
+ if( !node.isNull() ){
+ result->initialize(node);
+ return true;
+ }
+ return false;
+}
+
+bool Project::checkFreeRegisterAddressRange(QString address){
+ Ip ip;
+ QStringList ipList = getIpNames();
+ for( int i=0; i<ipList.count(); i++ ){
+ get(ipList.at(i), &ip);
+ if( ip.isRegisterAddressConflict(address) )
+ return false;
+ }
+ return true;
+}
+
+bool Project::modifyIpBaseAddress(QString ipName, QString baseAddress){
+ Ip ip;
+ if( get(ipName, &ip) ){
+ if( checkFreeRegisterAddressRange(baseAddress) ){
+ ip.setBaseAddress(baseAddress);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Project::computeIpBaseAddresses(){
+ Ip ip;
+ QStringList ipList = getIpNames();
+ if( ipList.count() > 0 ){
+ get(ipList.at(0), &ip);
+
+ // fix first IP address if not set
+ if( ip.getBaseAddress() == "" )
+ ip.setBaseAddress(QString::number(0));
+
+ int previousEndAddress = ip.getRegisterAddressRange().end() + 1;
+ printf("set ip %s base address %s \n", ip.getName().toLatin1().constData(), ip.getBaseAddress().toLatin1().constData());
+ for( int i=1; i<ipList.count(); i++ ){
+ get(ipList.at(i), &ip);
+ ip.setBaseAddress(QString::number(previousEndAddress));
+ printf("set ip %s base address %s \n", ip.getName().toLatin1().constData(), ip.getBaseAddress().toLatin1().constData());
+ int endAddress = ip.getRegisterAddressRange().end();
+ previousEndAddress = endAddress + 1;
+ }
+ }
+ else
+ printf("Warning no IP\n");
+ return true;
+}
+
+bool Project::saveToFile(QString aFileName){
+ QString finalFileName = aFileName;
+ if( aFileName == "" )
+ finalFileName = docFileName;
+ if( !finalFileName.contains(".pro") )
+ finalFileName.append(".pro");
+
+ QFile destFile(finalFileName);
+ if (!destFile.open(QIODevice::ReadWrite | QIODevice::Truncate)){
+ return false;
+ };
+
+ QString xmlContent = doc.toString();
+ QTextStream out(&destFile);
+ out << xmlContent;
+ return true;
+}
+
+bool Project::setToolchain(const QString type){
+ if( type.compare("xilinx") == 0 ){
+ return addToolchain("xilinx_toolchain.xml");
+ }
+ else {
+ printf("Error Altera projects not supported\n");
+ }
+ return false;
+}
+
+void Project::resolveProjectVariables( QString *command ){
+ QMap<QString, QString> variables = getProjectVariables();
+ QMapIterator<QString, QString> it(variables);
+
+ while (it.hasNext()) {
+ it.next();
+ command->replace("$"+it.key(),it.value()); // pour chaque command remplacer les variables de la map
+ }
+}
+
+
+void Project::resolveProjectVariables( QStringList *commandList ){
+ QMap<QString, QString> variables = getProjectVariables();
+ QMapIterator<QString, QString> it(variables);
+
+ for( int i=0; i<commandList->size(); i++ ){
+ while (it.hasNext()) {
+ it.next();
+ // printf("key: %s, valeu: %s \n",it.key().toLatin1().constData(), it.value().toLatin1().constData());
+ commandList->replaceInStrings("$"+it.key(),it.value()); // pour chaque command remplacer les variables de la map
+ }
+ }
+}
+
+
+
+
+/*
+QString Project::serializeIp(QString anIpName){
+ Ip *ip = findIp( anIpName );
+ if( ip )
+ return ip->serialize();
+ return "";
+}*/
+
+
Added: trunk/software/orchesta/common/project.h
===================================================================
--- trunk/software/orchesta/common/project.h (rev 0)
+++ trunk/software/orchesta/common/project.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,76 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** project.h: FPGA project manager
+**
+** author: th...@us...
+*/
+#ifndef PROJECT_H
+#define PROJECT_H
+
+#include "xmldoc.h"
+#include "ip.h"
+#include "platform.h"
+#include "toolchain.h"
+
+
+class Project
+{
+ protected:
+ QString docFileName;
+ QDomDocument doc;
+
+ virtual QDomNode findIpNode(QString anIpName);
+ virtual QDomNode findPlatformNode();
+ virtual QDomNode findToolchainNode();
+ virtual bool getDocFromXmlFile(QString fileName, QDomDocument *tempDoc);
+ virtual QMap<QString, QString> Project::getProjectVariables();
+
+ public:
+ Project();
+ virtual ~Project();
+
+ virtual bool removePlatform();
+ virtual bool removeIp(QString anIpName);
+ virtual bool addIp(QString ipName, QString ipFileName);
+ virtual bool addToolchain(QString toolchainTemplate);
+ virtual bool addPlatform(QString platformFileName);
+
+ virtual bool get(Platform *result);
+ virtual bool get(Toolchain *result);
+ virtual bool get(QString anIpName, Ip *result);
+ virtual QString getName();
+ virtual QString getFileName() {return docFileName;};
+
+ virtual bool modifyIpBaseAddress(QString ipName, QString baseAddress);
+ virtual bool computeIpBaseAddresses();
+ virtual bool checkFreeRegisterAddressRange(QString address);
+
+ virtual bool setToolchain(const QString type="Xilinx");
+
+ virtual QStringList getIpNames();
+ virtual bool initialize(QString aFileName);
+ virtual bool create(QString aFileName);
+ virtual bool saveToFile(QString aFileName="");
+ virtual void resolveProjectVariables( QStringList *commandList );
+ virtual void resolveProjectVariables( QString *command );
+
+};
+
+#endif // PROJECT_H
Added: trunk/software/orchesta/common/toolchain.cpp
===================================================================
--- trunk/software/orchesta/common/toolchain.cpp (rev 0)
+++ trunk/software/orchesta/common/toolchain.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,179 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** toolchain.cpp: FPGA toolchain wrapper
+**
+** author: th...@us...
+*/
+#include "toolchain.h"
+#include "project.h"
+#include "ip.h"
+#include "armadeus_ready.h"
+#include <qtextstream>
+#include <qprocess>
+#include <qfileinfo>
+#include <qdir>
+#include <qcoreapplication>
+
+void Toolchain::initialize(QDomNode aNode, Project* aProject){
+ XMLNodeWrapper::initialize(aNode);
+ project = aProject;
+}
+
+QStringList Toolchain::getCommandLines(){
+ QStringList result;
+ QDomElement flow = xmlNode.firstChildElement("flow");
+ QDomNodeList commandList = flow.childNodes();
+ for( int i =0; i<commandList.size(); i++ ){
+ if( commandList.at(i).isElement() ) { // avoid non Element
+ QString temp = commandList.at(i).toElement().attribute("name") + " " +
+ commandList.at(i).toElement().attribute("options");
+ result += temp;
+// printf("command list: %s\n", temp.toLatin1().constData());
+ }
+ }
+ return result;
+}
+
+bool Toolchain::copyIps(){
+
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ QStringList ipFileNameList = finder.getAllIpNames();
+ for( int i=0; i<ipFileNameList.count(); i++ ){
+ QString ipDirectory = QFileInfo(finder.getIpAbsoluteFilePath(ipFileNameList.at(i))).absolutePath();
+ QProcess process;
+// printf("cp -r %s/*.* .\n", ipDirectory.toLatin1().constData());
+// process.start("cp -r "+ipDirectory+"/*.* .");
+// printf("xcopy %s . /E\n", ipDirectory.replace(QString("/"), QString("\\")).toLatin1().constData());
+ process.start("xcopy "+ipDirectory.replace(QString("/"), QString("\\"))+" . /E /Y");
+ process.waitForFinished();
+ }
+ return true;
+}
+
+
+
+
+bool XilinxToolchain::buildXilinxPrj(){
+ Ip currentIp;
+ QStringList result;
+ QString projectName = project->getFileName();
+ QStringList ipNameList = project->getIpNames();
+
+ // create hdl top file list
+ for( int i=0; i<ipNameList.count(); i++ ){
+ if( project->get(ipNameList.at(i), ¤tIp ) ){
+// printf("IP: %s\n", currentIp.getName().toLatin1().constData());
+ QString topIpFileName = currentIp.getHDLTopName();
+ QStringList HDLlist = currentIp.getHDLNameList();
+ int pos = HDLlist.indexOf(topIpFileName);
+ if( pos != -1)
+ HDLlist.removeAt(pos);
+ HDLlist.prepend(topIpFileName); // reorganize in a proper order
+ if( topIpFileName != "" ){
+ for( int j=0; j<HDLlist.size(); j++ ){
+ if( !result.filter(HDLlist.at(j)).size() ) // if not already present in the list
+ {
+ if( QFileInfo(HDLlist.at(j)).suffix() == "vhd" ) // check whether it is a vhdl or a verilog file
+ result+= "vhdl work \""+HDLlist.at(j)+'"';
+ else if( QFileInfo(HDLlist.at(j)).suffix() == "v" )
+ result+= "verilog work \""+ HDLlist.at(j) + '"';
+ }
+ }
+ }
+ else
+ printf("Warning no top file for IP: %s", currentIp.getName().toLatin1().constData());
+ }
+ }
+
+ // create prj file
+ QFile file(project->getName()+".prj");
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)){
+ printf("can not create file %s\n", projectName.toLatin1().constData());
+ return false;
+ }
+
+ QTextStream out(&file);
+ for( int i=0; i<result.size(); i++ )
+ out << result.at(i) + "\n" ;
+ file.close();
+ return true;
+}
+
+void XilinxToolchain::checkErrors()
+{
+ QFile file(project->getName()+".log");
+ if (!file.open(QIODevice::ReadOnly)){
+ printf("Error: unable to open project log file\n");
+ } else {
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ QString line = in.readLine();
+ if(line.contains("ERROR:"))
+ printf("%s\n", line.toLatin1().constData());
+ }
+ }
+}
+
+bool XilinxToolchain::execute(){
+ if( project ){
+ if( !copyIps() )
+ return false;
+ QProcess builder;
+ builder.setProcessChannelMode(QProcess::MergedChannels);
+
+ // create .xstprojnav.tmp
+ QDir tempDir(".");
+ tempDir.mkdir(QString("xst"));
+ tempDir.mkdir(QString("xst/projnav.tmp"));
+
+ QDomElement flow = xmlNode.firstChildElement("xst_script");
+ QDomNodeList xst_script = flow.childNodes();
+ QString temp;
+ for( int i =0; i<xst_script.size(); i++ ){
+ temp += xst_script.at(i).toElement().attribute("name") + " " +
+ xst_script.at(i).toElement().attribute("options") + "\n";
+ }
+ project->resolveProjectVariables(&temp);
+
+ // create prj file
+ QFile file(project->getName()+".xst");
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate))
+ return false;
+ QTextStream out(&file);
+ out << temp;
+ file.close();
+
+ QStringList commandList = getCommandLines();
+ project->resolveProjectVariables(&commandList);
+
+ for( int i=0; i<commandList.size(); i++ ){
+// printf("%s\n", commandList.at(i).toLatin1().constData());
+ builder.start(commandList.at(i));
+ builder.waitForFinished();
+ }
+
+ // check errors in log file
+ checkErrors();
+
+ return true;
+ }
+ return false;
+}
Added: trunk/software/orchesta/common/toolchain.h
===================================================================
--- trunk/software/orchesta/common/toolchain.h (rev 0)
+++ trunk/software/orchesta/common/toolchain.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,69 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** toolchain.h: FPGA toolchain wrapper
+**
+** author: th...@us...
+*/
+#ifndef TOOLCHAIN_H
+#define TOOLCHAIN_H
+
+#include "xmldoc.h"
+#include "platform.h"
+
+class Project;
+
+class Toolchain : public XMLNodeWrapper
+{
+ protected:
+ Project *project;
+
+ virtual void checkErrors() = 0;
+ virtual bool copyIps();
+
+ public:
+ Toolchain():XMLNodeWrapper(){project=NULL;};
+ virtual ~Toolchain(){};
+
+ virtual QString getType() { return getAttribute("infos", "type"); };
+ virtual QStringList getCommandLines();
+ virtual bool execute() = 0;
+ virtual void initialize(QDomNode aNode, Project* aProject);
+
+};
+
+class XilinxToolchain : public Toolchain
+{
+ protected:
+ bool createXilinxScript();
+
+ virtual void checkErrors();
+
+ public:
+ XilinxToolchain():Toolchain(){};
+ virtual ~XilinxToolchain(){};
+
+ virtual bool execute();
+ virtual bool buildXilinxPrj();
+};
+
+
+
+
+#endif //TOOLCHAIN_H
Added: trunk/software/orchesta/common/xmldoc.cpp
===================================================================
--- trunk/software/orchesta/common/xmldoc.cpp (rev 0)
+++ trunk/software/orchesta/common/xmldoc.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,109 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** xmldoc.cpp: XML document base class
+**
+** author: th...@us...
+*/
+#include "xmldoc.h"
+#include <QTextStream>
+
+XMLNodeWrapper::XMLNodeWrapper(){
+}
+
+QString XMLNodeWrapper::getAttribute( QString subNodeName, QString elementName, QString attributeName ){
+ QDomElement subNode = xmlNode.firstChildElement(subNodeName);
+ if( !subNode.isNull() ){
+ QDomElement element = subNode.firstChildElement(elementName);
+ if( !element.isNull() )
+ return element.attribute(attributeName);
+ else{ // not a tag name. try with attribute name
+ QDomNodeList elementList = subNode.childNodes();
+ for( int i =0; i<elementList.size(); i++ ){
+ if( elementList.at(i).toElement().attribute("name") == elementName ){
+ return elementList.at(i).toElement().attribute(attributeName);
+ }
+ }
+ }
+ }
+ return QString();
+}
+
+QString XMLNodeWrapper::getAttribute( QString elementName, QString attributeName ){
+ QDomElement e;
+ e = xmlNode.firstChildElement(elementName);
+ if( !e.isNull() ){
+ return e.attribute(attributeName);
+ }
+ else { // not a tag name... look at a node with attribute elementName
+ QDomNodeList elementList = xmlNode.childNodes();
+ for( int i =0; i<elementList.size(); i++ ){
+ // printf("getAttribute %s", elementList.at(i).toElement().attribute("name").toLatin1().constData());
+ if( elementList.at(i).toElement().attribute("name") == elementName ){
+ return elementList.at(i).toElement().attribute(attributeName);
+ }
+ }
+ }
+ return "";
+}
+
+bool XMLNodeWrapper::setAttributeValue(QString elementName, QString attributeName, QString attributeValue)
+{
+ QDomElement element = xmlNode.firstChildElement(elementName);
+ if( !element.isNull() ){
+ element.setAttribute(attributeName, attributeValue);
+ return true;
+ }
+ return false;
+}
+
+bool XMLNodeWrapper::setAttributeValue(QString subNodeName, QString elementName, QString attributeName, QString attributeValue)
+{
+ QDomNode subNode = xmlNode.firstChildElement(subNodeName);
+ if( !subNode.isNull() ){
+ QDomElement element = subNode.firstChildElement(elementName);
+ if( !element.isNull() ){
+ element.setAttribute(attributeName, attributeValue);
+ return true;
+ }
+ }
+ return false;
+}
+
+QString XMLNodeWrapper::getCDATA( QString elementName ){
+ QDomElement e;
+ e = xmlNode.firstChildElement(elementName);
+ if( !e.isNull() ){
+ if( ! e.firstChild().toCDATASection().isNull() )
+ return e.firstChild().toCDATASection().data();
+ }
+ return "";
+}
+
+void XMLNodeWrapper::initialize(QDomNode aNode){
+ xmlNode = aNode;
+}
+
+QString XMLNodeWrapper::toString(){
+ QString result;
+ QTextStream stream(&result);
+ xmlNode.save(stream,4);
+ return result;
+}
+
Added: trunk/software/orchesta/common/xmldoc.h
===================================================================
--- trunk/software/orchesta/common/xmldoc.h (rev 0)
+++ trunk/software/orchesta/common/xmldoc.h 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,53 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** xmldoc.h: XML document base class
+**
+** author: th...@us...
+*/
+#ifndef XMLDOC_H
+#define XMLDOC_H
+
+#include <qstringlist>
+#include <qfile>
+#include <qdomdocument>
+
+
+
+class XMLNodeWrapper
+{
+ protected:
+ QDomNode xmlNode;
+ virtual QString getCDATA( QString elementName );
+
+ public:
+ XMLNodeWrapper();
+ virtual ~XMLNodeWrapper(){};
+
+ virtual void initialize(QDomNode aNode);
+ virtual QString getAttribute( QString elementName, QString attributeName );
+ virtual QString getAttribute( QString subNodeName, QString elementName, QString attributeName );
+ virtual bool setAttributeValue( QString subNodeName, QString elementName,
+ QString attributeName, QString attributeValue);
+ virtual bool setAttributeValue( QString elementName, QString attributeName, QString attributeValue);
+ virtual QString toString();
+
+};
+
+#endif // XMLDOC_H
Added: trunk/software/orchesta/plateform.xml
===================================================================
--- trunk/software/orchesta/plateform.xml (rev 0)
+++ trunk/software/orchesta/plateform.xml 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<platform>
+ <description>
+ <![CDATA[ gfdjgkfghdkfjghdf ]]>
+ </description>
+ <board type="APF9328" version="1"/>
+ <fpga type="XC3S200" speed="-4" package="TQ144" family="spartan" />
+</platform>
\ No newline at end of file
Added: trunk/software/orchesta/projectBuilder/main.cpp
===================================================================
--- trunk/software/orchesta/projectBuilder/main.cpp (rev 0)
+++ trunk/software/orchesta/projectBuilder/main.cpp 2007-06-30 09:22:49 UTC (rev 609)
@@ -0,0 +1,333 @@
+/*
+** THE ARMADEUS PROJECT
+**
+** Copyright (2007) The source forge armadeus project team
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** main.cpp: Project builder main file
+**
+** author: th...@us...
+*/
+#include <qcoreapplication>
+#include <qstring>
+#include <qstringlist>
+#include <qfile>
+//#include <qtextstream>
+#include <iostream>
+#include <qdir>
+#include <qdatetime>
+#include <qprocess>
+
+#include "platform.h"
+#include "project.h"
+#include "ip.h"
+#include "line_option.h"
+#include "toolchain.h"
+#include "armadeus_ready.h"
+
+
+bool buildXilinx( Project &pro ){
+ XilinxToolchain toolchain;
+ if( pro.get(&toolchain)){
+ if( !toolchain.buildXilinxPrj() )
+ return false;
+ if( toolchain.execute()) {
+ return true;
+ }
+ }
+ printf("Error: no valid toolchain\n");
+ return false;
+}
+
+
+bool initProject(Project *pro){
+ QDir dir;
+ QStringList list = dir.entryList(QStringList("*.pro"));
+ if( list.isEmpty() ){
+ printf("Please create a local project first\n");
+ return false;
+ }
+ pro->initialize(list.at(0));
+ return true;
+}
+
+void buildProject_callback(QStringList args){
+ Project pro;
+
+ if( initProject(&pro) ){
+ Platform plt;
+ pro.computeIpBaseAddresses();
+ if( pro.get(&plt) ) {
+ if( plt.getFPGAFamily() == "spartan" ){
+ buildXilinx(pro);
+ pro.saveToFile();
+ }
+ else
+ printf("unsupported FPGA Type\n");
+ }
+ else
+ printf("Error no platform found \n");
+ }
+ else
+ printf("Error no valid project\n");
+}
+
+
+void addIp_callback( QStringList args ){
+ Project pro;
+ if( initProject(&pro) ){
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ if( pro.addIp(args.at(0), finder.getIpAbsoluteFilePath(args.at(1))) )
+ pro.saveToFile();
+ }
+};
+
+void createNewProject_callback( QStringList args ){
+ Project pro;
+
+ if( pro.create(args.at(0)) ) {
+ if( pro.addPlatform(args.at(1)) )
+ pro.saveToFile();
+ }
+};
+
+void removeIp_callback( QStringList args ){
+ Project pro;
+ if( initProject(&pro) ){
+ if( pro.removeIp(args.at(0)) )
+ pro.saveToFile();
+ }
+};
+
+void listIps_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ printf("IP list:\n");
+ QStringList ipNameList = pro.getIpNames();
+ for( int i=0; i<ipNameList.count(); i++ )
+ printf("%s\n",ipNameList.at(i).toLatin1().constData());
+ }
+};
+
+void viewIpInfos_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ printf("%s",ip.toString().toLatin1().constData());
+ }
+}
+
+void viewPlatformInfos_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Platform plt;
+ if( pro.get(&plt) )
+ printf("%s",plt.toString().toLatin1().constData());
+ }
+}
+
+
+
+void clearIpBaseAddress_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setBaseAddress("");
+ }
+}
+
+void setIpBaseAddress_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setBaseAddress(args.at(1));
+ }
+}
+
+void setIpInterrupt_callback(QStringList args){
+ Project pro;
+ if( initProject(&pro) ){
+ Ip ip;
+ if( pro.get(args.at(0), &ip) )
+ ip.setInterrupt(args.at(1));
+ }
+}
+
+void listArmadeusReadyIps_callback(QStringList args){
+ ArmadeusReadyIpFinder finder;
+ finder.setPath(QCoreApplication::applicationDirPath()+ARMADEUS_READY_FOLDER);
+ printf("%s",finder.getAllIpNames().join("\n").toLatin1().constData());
+}
+
+void setToolchain_callback(QStringList args){
+ Project pro;
+
+ if( initProject(...
[truncated message content] |
|
From: <ar...@us...> - 2007-06-29 17:16:50
|
Revision: 608
http://armadeus.svn.sourceforge.net/armadeus/?rev=608&view=rev
Author: artemys
Date: 2007-06-29 10:16:53 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
[PACKAGE] Add Mesa support. At that time its only compiling and not tested !
Added Paths:
-----------
trunk/buildroot/package/mesa/
trunk/buildroot/package/mesa/Config.in
trunk/buildroot/package/mesa/mesa.mk
trunk/buildroot/package/mesa/mesa.patch
Added: trunk/buildroot/package/mesa/Config.in
===================================================================
--- trunk/buildroot/package/mesa/Config.in (rev 0)
+++ trunk/buildroot/package/mesa/Config.in 2007-06-29 17:16:53 UTC (rev 608)
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MESALIB
+ bool "Mesa library"
+ default n
+ select BR2_PACKAGE_GPM
+ help
+ Build MesaGL. It allows you to use OpenGL on your Armadeus board.
+
Added: trunk/buildroot/package/mesa/mesa.mk
===================================================================
--- trunk/buildroot/package/mesa/mesa.mk (rev 0)
+++ trunk/buildroot/package/mesa/mesa.mk 2007-06-29 17:16:53 UTC (rev 608)
@@ -0,0 +1,66 @@
+#############################################################
+#
+# Mesa
+#
+#############################################################
+
+MESALIB_VER:=7.0
+MESALIB_SOURCE:=MesaLib-$(MESALIB_VER).tar.bz2
+MESALIB_DEMOS:=MesaDemos-$(MESALIB_VER).tar.bz2
+MESAGLUT_SOURCE:=MesaGLUT-$(MESALIB_VER).tar.bz2
+MESALIB_SITE:=http://downloads.sourceforge.net/mesa3d
+MESALIB_DIR:=$(BUILD_DIR)/Mesa-$(MESALIB_VER)
+MESALIB_CAT:=bzcat
+MESALIB_PATCH:=mesa.patch
+
+
+$(DL_DIR)/$(MESALIB_SOURCE):
+ $(WGET) -P $(DL_DIR) $(MESALIB_SITE)/$(MESALIB_SOURCE)
+
+$(DL_DIR)/$(MESALIB_DEMOS):
+ $(WGET) -P $(DL_DIR) $(MESALIB_SITE)/$(MESALIB_DEMOS)
+
+$(DL_DIR)/$(MESAGLUT_SOURCE):
+ $(WGET) -P $(DL_DIR) $(MESALIB_SITE)/$(MESAGLUT_SOURCE)
+
+mesa-source: $(DL_DIR)/$(MESALIB_SOURCE) $(DL_DIR)/$(MESALIB_DEMOS)
+
+$(MESALIB_DIR)/.unpacked: $(DL_DIR)/$(MESALIB_SOURCE) $(DL_DIR)/$(MESALIB_DEMOS) $(DL_DIR)/$(MESAGLUT_SOURCE)
+ $(MESALIB_CAT) $(DL_DIR)/$(MESALIB_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ $(MESALIB_CAT) $(DL_DIR)/$(MESALIB_DEMOS) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ $(MESALIB_CAT) $(DL_DIR)/$(MESAGLUT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(MESALIB_DIR)/.patched: $(MESALIB_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(MESALIB_DIR) package/mesa $(MESALIB_PATCH)
+ touch $@
+
+$(MESALIB_DIR)/.configured: $(MESALIB_DIR)/.patched
+ touch $@
+
+$(MESALIB_DIR)/.compiled: $(MESALIB_DIR)/.configured
+ (cd $(MESALIB_DIR); \
+ $(MAKE) realclean; \
+ $(MAKE) CC=$(TARGET_CC) CXX=$(TARGET_CXX) linux-fbdev \
+ );
+#arm-linux-osmesa
+ touch $@
+
+MESA mesa: uclibc gpm $(MESALIB_DIR)/.compiled
+
+mesa-clean:
+ (cd $(MESALIB_DIR); \
+ $(MAKE) CC=$(TARGET_CC) clean \
+ );
+
+mesa-dirclean:
+ rm -rf $(MESALIB_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_MESALIB)),y)
+TARGETS+=mesa
+endif
Added: trunk/buildroot/package/mesa/mesa.patch
===================================================================
--- trunk/buildroot/package/mesa/mesa.patch (rev 0)
+++ trunk/buildroot/package/mesa/mesa.patch 2007-06-29 17:16:53 UTC (rev 608)
@@ -0,0 +1,167 @@
+diff -bruN Mesa-7.0.orig/configs/arm-linux-osmesa Mesa-7.0/configs/arm-linux-osmesa
+--- Mesa-7.0.orig/configs/arm-linux-osmesa 1970-01-01 01:00:00.000000000 +0100
++++ Mesa-7.0/configs/arm-linux-osmesa 2007-06-26 23:00:52.000000000 +0200
+@@ -0,0 +1,25 @@
++# Configuration for building only libOSMesa on Linux, no Xlib driver
++# This doesn't really have any Linux dependencies, so it should be usable
++# on other (gcc-based) systems.
++
++include $(TOP)/configs/default
++
++CONFIG_NAME = arm-linux-osmesa
++
++# Compiler and flags
++CC = gcc
++CXX = g++
++CFLAGS = -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
++CXXFLAGS = -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
++
++
++# Directories
++SRC_DIRS = mesa
++DRIVER_DIRS = osmesa
++PROGRAM_DIRS = osdemos
++
++
++# Dependencies
++OSMESA_LIB_DEPS = -lm -lpthread
++GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
++APP_LIB_DEPS = -lOSMesa
+diff -bruN Mesa-7.0.orig/Makefile Mesa-7.0/Makefile
+--- Mesa-7.0.orig/Makefile 2007-06-22 00:14:38.000000000 +0200
++++ Mesa-7.0/Makefile 2007-06-26 22:31:34.000000000 +0200
+@@ -111,6 +111,7 @@
+ linux-ia64-icc-static \
+ linux-icc \
+ linux-icc-static \
++arm-linux-osmesa \
+ linux-osmesa \
+ linux-osmesa16 \
+ linux-osmesa16-static \
+diff -bruN Mesa-7.0.orig/progs/osdemos/osdemo.c Mesa-7.0/progs/osdemos/osdemo.c
+--- Mesa-7.0.orig/progs/osdemos/osdemo.c 2007-06-26 23:05:40.000000000 +0200
++++ Mesa-7.0/progs/osdemos/osdemo.c 2007-06-26 22:44:58.000000000 +0200
+@@ -22,7 +22,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include "GL/osmesa.h"
+-#include "GL/glu.h"
++/*#include "GL/glu.h"*/
+
+
+ #define SAVE_TARGA
+@@ -30,7 +30,7 @@
+ static int Width = 400;
+ static int Height = 400;
+
+-
++/*
+ static void
+ Sphere(float radius, int slices, int stacks)
+ {
+@@ -50,7 +50,7 @@
+ gluCylinder(q, base, 0.0, height, slices, stacks);
+ gluDeleteQuadric(q);
+ }
+-
++*/
+
+ static void
+ Torus(float innerRadius, float outerRadius, int sides, int rings)
+@@ -131,7 +131,7 @@
+ Torus(0.275, 0.85, 20, 20);
+ glPopMatrix();
+
+- glPushMatrix();
++/* glPushMatrix();
+ glTranslatef(-0.75, -0.5, 0.0);
+ glRotatef(270.0, 1.0, 0.0, 0.0);
+ glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green_mat );
+@@ -143,7 +143,7 @@
+ glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
+ Sphere(1.0, 20, 20);
+ glPopMatrix();
+-
++*/
+ glPopMatrix();
+
+ /* This is very important!!!
+diff -bruN Mesa-7.0.orig/progs/osdemos/ostest1.c Mesa-7.0/progs/osdemos/ostest1.c
+--- Mesa-7.0.orig/progs/osdemos/ostest1.c 2007-06-26 23:05:40.000000000 +0200
++++ Mesa-7.0/progs/osdemos/ostest1.c 2007-06-26 22:47:58.000000000 +0200
+@@ -14,7 +14,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include "GL/osmesa.h"
+-#include "GL/glu.h"
++/*#include "GL/glu.h"*/
+
+
+ #define WIDTH 600
+@@ -23,7 +23,7 @@
+ static GLboolean WriteFiles = GL_FALSE;
+ static GLboolean Gradient = GL_FALSE;
+
+-
++/*
+ static void
+ Sphere(float radius, int slices, int stacks)
+ {
+@@ -43,7 +43,7 @@
+ gluCylinder(q, base, 0.0, height, slices, stacks);
+ gluDeleteQuadric(q);
+ }
+-
++*/
+
+ static void
+ Torus(float innerRadius, float outerRadius, int sides, int rings)
+@@ -225,7 +225,7 @@
+ glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red_mat );
+ Torus(0.275, 0.85, 20, 20);
+ glPopMatrix();
+-
++/*
+ glPushMatrix();
+ glTranslatef(-1.5, -0.5, 0.0);
+ glRotatef(270.0, 1.0, 0.0, 0.0);
+@@ -241,7 +241,7 @@
+ Sphere(1.2, 20, 20);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glPopMatrix();
+-
++*/
+ #if 0
+ glPushMatrix();
+ glTranslatef(0.75, 0.0, 1.3);
+diff -bruN Mesa-7.0.orig/src/mesa/Makefile Mesa-7.0/src/mesa/Makefile
+--- Mesa-7.0.orig/src/mesa/Makefile 2007-06-22 00:10:54.000000000 +0200
++++ Mesa-7.0/src/mesa/Makefile 2007-06-26 22:31:34.000000000 +0200
+@@ -107,7 +107,7 @@
+
+ stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
+
+-osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
++osmesa-only: depend $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME)
+
+ # Make the GL library
+ $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
+@@ -139,13 +139,13 @@
+ depend: $(ALL_SOURCES)
+ @ echo "running $(MKDEP)"
+ @ touch depend
+- @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
+- > /dev/null 2>/dev/null
++ @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) #\
++ #> /dev/null 2>/dev/null
+
+
+-subdirs:
+- @ (cd x86 ; $(MAKE))
+- @ (cd x86-64 ; $(MAKE))
++#subdirs:
++# @ (cd x86 ; $(MAKE))
++# @ (cd x86-64 ; $(MAKE))
+
+
+ install: default
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-06-29 17:16:24
|
Revision: 607
http://armadeus.svn.sourceforge.net/armadeus/?rev=607&view=rev
Author: artemys
Date: 2007-06-29 10:16:24 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
[PACKAGE] Add GPM support. At that time its only compiling and not tested
Added Paths:
-----------
trunk/buildroot/package/gpm/
trunk/buildroot/package/gpm/Config.in
trunk/buildroot/package/gpm/gpm.mk
trunk/buildroot/package/gpm/gpm.patch
Added: trunk/buildroot/package/gpm/Config.in
===================================================================
--- trunk/buildroot/package/gpm/Config.in (rev 0)
+++ trunk/buildroot/package/gpm/Config.in 2007-06-29 17:16:24 UTC (rev 607)
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_GPM
+ bool "GPM Mouse server"
+ default n
+ help
+ GPM means general purpose mouse and is the mouse support for linux in the console.
Added: trunk/buildroot/package/gpm/gpm.mk
===================================================================
--- trunk/buildroot/package/gpm/gpm.mk (rev 0)
+++ trunk/buildroot/package/gpm/gpm.mk 2007-06-29 17:16:24 UTC (rev 607)
@@ -0,0 +1,86 @@
+#############################################################
+#
+# GPM: mouse support for linux in the console
+#
+#############################################################
+
+GPM_VER:=1.20.0
+GPM_SOURCE:=gpm-$(GPM_VER).tar.bz2
+GPM_SITE:=http://unix.schottelius.org/gpm/archives/old/
+GPM_DIR:=$(BUILD_DIR)/gpm-$(GPM_VER)
+GPM_CAT:=bzcat
+GPM_PATCH:=gpm.patch
+
+
+$(DL_DIR)/$(GPM_SOURCE):
+ $(WGET) -P $(DL_DIR) $(GPM_SITE)/$(GPM_SOURCE)
+
+gpm-source: $(DL_DIR)/$(GPM_SOURCE)
+
+$(GPM_DIR)/.unpacked: $(DL_DIR)/$(GPM_SOURCE) $(DL_DIR)/$(GPM_DEMOS) $(DL_DIR)/$(MESAGLUT_SOURCE)
+ $(GPM_CAT) $(DL_DIR)/$(GPM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(GPM_DIR)/.patched: $(GPM_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(GPM_DIR) package/gpm $(GPM_PATCH)
+ touch $@
+
+$(GPM_DIR)/.configured: $(GPM_DIR)/.patched
+ (cd $(GPM_DIR); \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS) " \
+ LDFLAGS="-Wl,-rpath=$(STAGING_DIR)/lib/" \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=$(STAGING_DIR)/usr \
+ );
+ touch $@
+
+$(GPM_DIR)/.compiled: $(GPM_DIR)/.configured
+ (cd $(GPM_DIR); \
+ $(MAKE) CC=$(TARGET_CC) CXX=$(TARGET_CC) \
+ );
+ touch $@
+
+$(STAGING_DIR)/usr/sbin/gpm: $(GPM_DIR)/.compiled
+ (cd $(GPM_DIR); \
+ $(MAKE) CC=$(TARGET_CC) CXX=$(TARGET_CC) install \
+ );
+# Bug in GPM automake/conf stuff ? anyone knows a better way to patch that ? -->
+ (cd $(STAGING_DIR)/usr/lib/; \
+ mv libgpm.so.1.19.0 libgpm.so.$(GPM_VER); \
+ ln -sf libgpm.so.$(GPM_VER) libgpm.so.1; \
+ ln -sf libgpm.so.$(GPM_VER) libgpm.so; \
+ );
+ touch $@
+
+$(TARGET_DIR)/usr/sbin/gpm: $(STAGING_DIR)/usr/sbin/gpm
+ cp -dpf $(STAGING_DIR)/usr/sbin/gpm $(TARGET_DIR)/usr/sbin/
+ $(STRIP) --strip-unneeded $(TARGET_DIR)/usr/sbin/gpm
+ cp -dpf $(STAGING_DIR)/usr/bin/gpm-root $(TARGET_DIR)/usr/bin/
+ $(STRIP) --strip-unneeded $(TARGET_DIR)/usr/bin/gpm-root
+ cp -dpf $(STAGING_DIR)/usr/lib/libgpm.so* $(TARGET_DIR)/usr/lib/
+ $(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libgpm.so.1.*
+
+GPM gpm: uclibc $(TARGET_DIR)/usr/sbin/gpm
+
+gpm-clean:
+ (cd $(GPM_DIR); \
+ $(MAKE) clean \
+ );
+ rm $(GPM_DIR)/.compiled
+ rm $(TARGET_DIR)/usr/lib/libgpm.so*
+
+gpm-dirclean:
+ rm -rf $(GPM_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_GPM)),y)
+TARGETS+=gpm
+endif
Added: trunk/buildroot/package/gpm/gpm.patch
===================================================================
--- trunk/buildroot/package/gpm/gpm.patch (rev 0)
+++ trunk/buildroot/package/gpm/gpm.patch 2007-06-29 17:16:24 UTC (rev 607)
@@ -0,0 +1,30 @@
+diff -urN gpm-1.20.0/src/gpm-root.y gpm-1.20.0.mod/src/gpm-root.y
+--- gpm-1.20.0/src/gpm-root.y 2002-02-23 16:42:23.000000000 +0100
++++ gpm-1.20.0.mod/src/gpm-root.y 2007-06-29 16:17:59.000000000 +0200
+@@ -332,6 +332,7 @@
+ case ' ': /* fall through */
+ case '\t': continue;
+ default: if (!isalpha(c)) return(c);
++ break;
+ }
+ /* get a single word and convert it */
+ do {
+@@ -498,6 +499,7 @@
+ case F_CREATE:
+ case F_POST: break;
+ case F_INVOKE: /* MISS */
++ break;
+ }
+ return 0;
+ }
+diff -urN gpm-1.20.0/src/synaptics.c gpm-1.20.0.mod/src/synaptics.c
+--- gpm-1.20.0/src/synaptics.c 2002-02-23 16:42:23.000000000 +0100
++++ gpm-1.20.0.mod/src/synaptics.c 2007-06-29 16:16:13.000000000 +0200
+@@ -816,6 +816,7 @@
+ break;
+
+ default:
++ break;
+ }
+ }
+ }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-06-27 21:26:28
|
Revision: 606
http://armadeus.svn.sourceforge.net/armadeus/?rev=606&view=rev
Author: artemys
Date: 2007-06-27 14:26:28 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
[BUILDROOT] Tslib is compiling
Added Paths:
-----------
trunk/buildroot/package/tslib/
trunk/buildroot/package/tslib/Config.in
trunk/buildroot/package/tslib/patches/
trunk/buildroot/package/tslib/patches/configure-malloc.patch
trunk/buildroot/package/tslib/tslib.mk
Added: trunk/buildroot/package/tslib/Config.in
===================================================================
--- trunk/buildroot/package/tslib/Config.in (rev 0)
+++ trunk/buildroot/package/tslib/Config.in 2007-06-27 21:26:28 UTC (rev 606)
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_TSLIB
+ bool "tslib"
+ select BR2_INSTALL_LIBSTDCPP
+ default n
+ help
+ Tslib is an abstraction layer for touchscreen panel events.
+
+ See: http://tslib.berlios.de/
Added: trunk/buildroot/package/tslib/patches/configure-malloc.patch
===================================================================
--- trunk/buildroot/package/tslib/patches/configure-malloc.patch (rev 0)
+++ trunk/buildroot/package/tslib/patches/configure-malloc.patch 2007-06-27 21:26:28 UTC (rev 606)
@@ -0,0 +1,12 @@
+Index: tslib-1.0/configure.ac
+===================================================================
+--- tslib-1.0.orig/configure.ac
++++ tslib-1.0/configure.ac
+@@ -43,7 +43,6 @@ AC_HEADER_TIME
+
+ # Checks for library functions.
+ AC_PROG_GCC_TRADITIONAL
+-AC_FUNC_MALLOC
+ AC_FUNC_MMAP
+ AC_FUNC_SELECT_ARGTYPES
+ AC_TYPE_SIGNAL
Added: trunk/buildroot/package/tslib/tslib.mk
===================================================================
--- trunk/buildroot/package/tslib/tslib.mk (rev 0)
+++ trunk/buildroot/package/tslib/tslib.mk 2007-06-27 21:26:28 UTC (rev 606)
@@ -0,0 +1,86 @@
+#############################################################
+#
+# tslib
+#
+#############################################################
+TSLIB_SOURCE:=tslib-1.0.tar.bz2
+TSLIB_SITE:=http://download.berlios.de/tslib
+TSLIB_DIR:=$(BUILD_DIR)/tslib-1.0
+TSLIB_CAT:=bzcat
+
+$(DL_DIR)/$(TSLIB_SOURCE):
+ $(WGET) -P $(DL_DIR) $(TSLIB_SITE)/$(TSLIB_SOURCE)
+
+tslib-source: $(DL_DIR)/$(TSLIB_SOURCE)
+
+$(TSLIB_DIR)/.unpacked: $(DL_DIR)/$(TSLIB_SOURCE)
+ $(TSLIB_CAT) $(DL_DIR)/$(TSLIB_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(TSLIB_DIR)/.patched: $(TSLIB_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(TSLIB_DIR) package/tslib/patches \*.patch
+ touch $@
+
+$(TSLIB_DIR)/.configured: $(TSLIB_DIR)/.patched
+ (cd $(TSLIB_DIR); \
+ ./autogen.sh; \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS) " \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=$(STAGING_DIR)/usr \
+ --disable-linear-h2200 \
+ --disable-collie \
+ --disable-h3600 \
+ --disable-mk712 \
+ --disable-arctic2 \
+ --disable-ucb1x00 \
+ --enable-input \
+ );
+ touch $@
+
+$(TSLIB_DIR)/.compiled: $(TSLIB_DIR)/.configured
+ $(MAKE) -C $(TSLIB_DIR)
+ touch $@
+
+$(STAGING_DIR)/usr/lib/libts-0.0.so.0.1.1: $(TSLIB_DIR)/.compiled
+ $(MAKE) -C $(TSLIB_DIR) install
+ touch -c $(STAGING_DIR)/usr/lib/libts-0.0.so.0.1.1
+
+$(TARGET_DIR)/usr/lib/libts-0.0.so.0.1.1: $(STAGING_DIR)/usr/lib/libts-0.0.so.0.1.1
+ cp -dpf $(STAGING_DIR)/usr/lib/libts*.so* $(TARGET_DIR)/usr/lib/
+ -$(STRIP) $(TARGET_DIR)/usr/lib/libts.so
+ cp -dpf $(TSLIB_DIR)/plugins/.libs/dejitter.so $(TARGET_DIR)/usr/lib
+ -$(STRIP) $(TARGET_DIR)/usr/lib/dejitter.so
+ cp -dpf $(TSLIB_DIR)/plugins/.libs/input.so $(TARGET_DIR)/usr/lib
+ -$(STRIP) $(TARGET_DIR)/usr/lib/input.so
+ cp -dpf $(TSLIB_DIR)/plugins/.libs/linear.so $(TARGET_DIR)/usr/lib
+ -$(STRIP) $(TARGET_DIR)/usr/lib/linear.so
+ cp -dpf $(TSLIB_DIR)/plugins/.libs/pthres.so $(TARGET_DIR)/usr/lib
+ -$(STRIP) $(TARGET_DIR)/usr/lib/pthres.so
+ cp -dpf $(TSLIB_DIR)/plugins/.libs/variance.so $(TARGET_DIR)/usr/lib
+ -$(STRIP) $(TARGET_DIR)/usr/lib/variance.so
+ cp -dpf $(TSLIB_DIR)/tests/.libs/ts_* $(TARGET_DIR)/root
+ -$(STRIP) $(TARGET_DIR)/root/ts_*
+ cp -dpf $(TSLIB_DIR)/etc/ts.conf $(TARGET_DIR)/etc
+ toolchain/patch-kernel.sh $(TARGET_DIR)/etc package/tslib/patches/ ts.conf.patch
+
+tslib: uclibc $(TARGET_DIR)/usr/lib/libts-0.0.so.0.1.1
+
+tslib-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(TSLIB_DIR) uninstall
+ -$(MAKE) -C $(TSLIB_DIR) clean
+
+tslib-dirclean:
+ rm -rf $(TSLIB_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_TSLIB)),y)
+TARGETS+=tslib
+endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2007-06-08 15:07:07
|
Revision: 605
http://armadeus.svn.sourceforge.net/armadeus/?rev=605&view=rev
Author: artemys
Date: 2007-06-08 08:06:56 -0700 (Fri, 08 Jun 2007)
Log Message:
-----------
[BUILDROOT] Add ipkg package (for target) in buildroot
Still needs Host part to build .ipk packages
Added Paths:
-----------
trunk/buildroot/package/ipkg/
trunk/buildroot/package/ipkg/Config.in
trunk/buildroot/package/ipkg/files/
trunk/buildroot/package/ipkg/files/ipkg
trunk/buildroot/package/ipkg/ipkg.mk
trunk/buildroot/package/ipkg/patches/
trunk/buildroot/package/ipkg/patches/no-diff.patch
trunk/patches/020-buildroot-ipkg.diff
Added: trunk/buildroot/package/ipkg/Config.in
===================================================================
--- trunk/buildroot/package/ipkg/Config.in (rev 0)
+++ trunk/buildroot/package/ipkg/Config.in 2007-06-08 15:06:56 UTC (rev 605)
@@ -0,0 +1,43 @@
+config BR2_PACKAGE_IPKG
+ tristate
+ default n
+ depends BR2_PACKAGE_IPKG_C || BR2_PACKAGE_IPKG_SH
+
+config BR2_PACKAGE_IPKG_C
+ tristate "ipkg - itsy package management system"
+ default n
+ select BR2_PACKAGE_IPKG
+ help
+ Lightweight package management system
+ ipkg is the Itsy Package Management System, for handling
+ installation and removal of packages on a system. It can
+ recursively follow dependencies and download all packages
+ necessary to install a particular package.
+
+ ipkg knows how to install both .ipk and .deb packages.
+
+ ipkg is intended to serve the same functions (and more) for
+ Familiar that dpkg and apt serve for Debian, (while taking
+ up much less space).
+
+config BR2_PACKAGE_IPKG_SH
+ tristate "ipkg-sh - itsy package management system (shell version)"
+ default m if CONFIG_DEVEL
+ default m if BR2_PACKAGE_IMAGEBUILDER
+ select BR2_PACKAGE_IPKG
+ help
+ Lightweight package management system
+ ipkg is the Itsy Package Management System, for handling
+ installation and removal of packages on a system. It can
+ recursively follow dependencies and download all packages
+ necessary to install a particular package.
+
+ ipkg knows how to install both .ipk and .deb packages.
+
+ ipkg is intended to serve the same functions (and more) for
+ Familiar that dpkg and apt serve for Debian, (while taking
+ up much less space).
+
+if (BR2_PACKAGE_IPKG_C = y) && (BR2_PACKAGE_IPKG_SH = y)
+ comment "WARNING: both ipkg and ipkg-sh are selected for installation !"
+endif
Added: trunk/buildroot/package/ipkg/files/ipkg
===================================================================
--- trunk/buildroot/package/ipkg/files/ipkg (rev 0)
+++ trunk/buildroot/package/ipkg/files/ipkg 2007-06-08 15:06:56 UTC (rev 605)
@@ -0,0 +1,1188 @@
+#!/bin/sh
+# ipkg - the itsy package management system
+#
+# Copyright (C) 2001 Carl D. Worth
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+set -e
+
+# By default do not do globbing. Any command wanting globbing should
+# explicitly enable it first and disable it afterwards.
+set -o noglob
+
+ipkg_is_upgrade () {
+ local A B a b
+ A=$(echo $1 | sed -r "s/([0-9]+)[^[:alnum:]]*/ \1 /g").
+ B=$(echo $2 | sed -r "s/([0-9]+)[^[:alnum:]]*/ \1 /g").
+ while [ \! -z "$A" ] && [ \! -z "$B" ]; do {
+ set $A; a=$1; shift; A=$*
+ set $B; b=$1; shift; B=$*
+ [ "$a" -lt "$b" ] 2>&- && return 1
+ { [ "$a" -gt "$b" ] 2>&- || [ "$a" ">" "$b" ]; } && return
+ }; done
+ return 1
+}
+
+ipkg_srcs() {
+ local srcre="$1"
+ sed -ne "s/^src[[:space:]]\+$srcre[[:space:]]\+//p" < $IPKG_CONF
+}
+
+ipkg_src_names() {
+ sed -ne "s/^src[[:space:]]\+\([^[:space:]]\+\).*/\1/p" < $IPKG_CONF
+}
+
+ipkg_src_byname() {
+ local src="$1"
+ ipkg_srcs $src | head -1
+}
+
+ipkg_dests() {
+ local destre="`echo $1 | ipkg_protect_slashes`"
+ sed -ne "/^dest[[:space:]]\+$destre/{
+s/^dest[[:space:]]\+[^[:space:]]\+[[:space:]]\+//
+s/^/`echo $IPKG_OFFLINE_ROOT | ipkg_protect_slashes`/
+p
+}" < $IPKG_CONF
+}
+
+ipkg_dest_names() {
+ sed -ne "s/^dest[[:space:]]\+\([^[:space:]]\+\).*/\1/p" < $IPKG_CONF
+}
+
+ipkg_dests_all() {
+ ipkg_dests '.*'
+}
+
+ipkg_state_dirs() {
+ ipkg_dests_all | sed "s|\$|/$IPKG_DIR_PREFIX|"
+}
+
+ipkg_dest_default() {
+ ipkg_dests_all | head -1
+}
+
+ipkg_dest_default_name() {
+ ipkg_dest_names | head -1
+}
+
+ipkg_dest_byname() {
+ local dest="$1"
+ ipkg_dests $dest | head -1
+}
+
+ipkg_option() {
+ local option="$1"
+ sed -ne "s/^option[[:space:]]\+$option[[:space:]]\+//p" < $IPKG_CONF
+}
+
+ipkg_load_configuration() {
+ if [ -z "$IPKG_CONF_DIR" ]; then
+ IPKG_CONF_DIR=/etc
+ fi
+
+ IPKG_CONF="$IPKG_CONF_DIR/ipkg.conf"
+
+ if [ -z "$IPKG_OFFLINE_ROOT" ]; then
+ IPKG_OFFLINE_ROOT="`ipkg_option offline_root`"
+ fi
+ # Export IPKG_OFFLINE_ROOT for use by update-alternatives
+ export IPKG_OFFLINE_ROOT
+ if [ -n "$DEST_NAME" ]; then
+ IPKG_ROOT="`ipkg_dest_byname $DEST_NAME`"
+ if [ -z "$IPKG_ROOT" ]; then
+ if [ -d "$IPKG_OFFLINE_ROOT$DEST_NAME" ]; then
+ IPKG_ROOT="$IPKG_OFFLINE_ROOT$DEST_NAME";
+ else
+ echo "ipkg: invalid destination specification: $DEST_NAME
+Valid destinations are directories or one of the dest names from $IPKG_CONF:" >&2
+ ipkg_dest_names >&2
+ return 1
+ fi
+ fi
+ else
+ IPKG_ROOT="`ipkg_dest_default`"
+ fi
+
+ # Global ipkg state directories
+ IPKG_DIR_PREFIX=usr/lib/ipkg
+ IPKG_LISTS_DIR=$IPKG_OFFLINE_ROOT/$IPKG_DIR_PREFIX/lists
+ IPKG_PENDING_DIR=$IPKG_OFFLINE_ROOT/$IPKG_DIR_PREFIX/pending
+ IPKG_TMP=$IPKG_ROOT/tmp/ipkg
+
+ # Destination specific ipkg meta-data directory
+ IPKG_STATE_DIR=$IPKG_ROOT/$IPKG_DIR_PREFIX
+
+ # Proxy Support
+ IPKG_PROXY_USERNAME="`ipkg_option proxy_username`"
+ IPKG_PROXY_PASSWORD="`ipkg_option proxy_password`"
+ IPKG_HTTP_PROXY="`ipkg_option http_proxy`"
+ IPKG_FTP_PROXY="`ipkg_option ftp_proxy`"
+ IPKG_NO_PROXY="`ipkg_option no_proxy`"
+ if [ -n "$IPKG_HTTP_PROXY" ]; then
+ export http_proxy="$IPKG_HTTP_PROXY"
+ fi
+
+ if [ -n "$IPKG_FTP_PROXY" ]; then
+ export ftp_proxy="$IPKG_FTP_PROXY"
+ fi
+
+ if [ -n "$IPKG_NO_PROXY" ]; then
+ export no_proxy="$IPKG_NO_PROXY"
+ fi
+
+ IPKG_STATUS_FIELDS='\(Package\|Status\|Essential\|Version\|Conffiles\|Root\)'
+}
+
+ipkg_usage() {
+ [ $# -gt 0 ] && echo "ipkg: $*"
+ echo "
+usage: ipkg [options...] sub-command [arguments...]
+where sub-command is one of:
+
+Package Manipulation:
+ update Update list of available packages
+ upgrade Upgrade all installed packages to latest version
+ install <pkg> Download and install <pkg> (and dependencies)
+ install <file.ipk> Install package <file.ipk>
+ install <file.deb> Install package <file.deb>
+ remove <pkg> Remove package <pkg>
+
+Informational Commands:
+ list List available packages and descriptions
+ files <pkg> List all files belonging to <pkg>
+ search <file> Search for a packaging providing <file>
+ info [pkg [<field>]] Display all/some info fields for <pkg> or all
+ status [pkg [<field>]] Display all/some status fields for <pkg> or all
+ depends <pkg> Print uninstalled package dependencies for <pkg>
+
+Options:
+ -d <dest_name> Use <dest_name> as the the root directory for
+ -dest <dest_name> package installation, removal, upgrading.
+ <dest_name> should be a defined dest name from the
+ configuration file, (but can also be a directory
+ name in a pinch).
+ -o <offline_root> Use <offline_root> as the root for offline installation.
+ -offline <offline_root>
+
+Force Options (use when ipkg is too smart for its own good):
+ -force-depends Make dependency checks warnings instead of errors
+ -force-defaults Use default options for questions asked by ipkg.
+ (no prompts). Note that this will not prevent
+ package installation scripts from prompting.
+" >&2
+ exit 1
+}
+
+ipkg_dir_part() {
+ local dir="`echo $1 | sed -ne 's/\(.*\/\).*/\1/p'`"
+ if [ -z "$dir" ]; then
+ dir="./"
+ fi
+ echo $dir
+}
+
+ipkg_file_part() {
+ echo $1 | sed 's/.*\///'
+}
+
+ipkg_protect_slashes() {
+ sed -e 's/\//\\\//g'
+}
+
+ipkg_download() {
+ local src="$1"
+ local dest="$2"
+
+ local src_file="`ipkg_file_part $src`"
+ local dest_dir="`ipkg_dir_part $dest`"
+ if [ -z "$dest_dir" ]; then
+ dest_dir="$IPKG_TMP"
+ fi
+
+ local dest_file="`ipkg_file_part $dest`"
+ if [ -z "$dest_file" ]; then
+ dest_file="$src_file"
+ fi
+
+ # Proxy support
+ local proxyuser=""
+ local proxypassword=""
+ local proxyoption=""
+
+ if [ -n "$IPKG_PROXY_USERNAME" ]; then
+ proxyuser="--proxy-user=\"$IPKG_PROXY_USERNAME\""
+ proxypassword="--proxy-passwd=\"$IPKG_PROXY_PASSWORD\""
+ fi
+
+ if [ -n "$IPKG_PROXY_HTTP" -o -n "$IPKG_PROXY_FTP" ]; then
+ proxyoption="--proxy=on"
+ fi
+
+ echo "Downloading $src ..."
+ rm -f $IPKG_TMP/$src_file
+ case "$src" in
+ http://* | ftp://*)
+ if ! wget --passive-ftp $proxyoption $proxyuser $proxypassword -P $IPKG_TMP $src; then
+ echo "ipkg_download: ERROR: Failed to retrieve $src, returning $err"
+ return 1
+ fi
+ mv $IPKG_TMP/$src_file $dest_dir/$dest_file 2>/dev/null
+ ;;
+ file:/* )
+ ln -s `echo $src | sed 's/^file://'` $dest_dir/$dest_file 2>/dev/null
+ ;;
+ *)
+ echo "DEBUG: $src"
+ ;;
+ esac
+
+ echo "Done."
+ return 0
+}
+
+ipkg_update() {
+ if [ ! -e "$IPKG_LISTS_DIR" ]; then
+ mkdir -p $IPKG_LISTS_DIR
+ fi
+
+ local err=
+ for src_name in `ipkg_src_names`; do
+ local src="`ipkg_src_byname $src_name`"
+ if ! ipkg_download $src/Packages $IPKG_LISTS_DIR/$src_name; then
+ echo "ipkg_update: Error downloading $src/Packages to $IPKG_LISTS_DIR/$src_name" >&2
+ err=t
+ else
+ echo "Updated list of available packages in $IPKG_LISTS_DIR/$src_name"
+ fi
+ done
+
+ [ -n "$err" ] && return 1
+
+ return 0
+}
+
+ipkg_list() {
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+# black magic...
+sed -ne "
+/^Package:/{
+s/^Package:[[:space:]]*\<\([a-z0-9.+-]*$1[a-z0-9.+-]*\).*/\1/
+h
+}
+/^Description:/{
+s/^Description:[[:space:]]*\(.*\)/\1/
+H
+g
+s/\\
+/ - /
+p
+}
+" $IPKG_LISTS_DIR/$src
+ fi
+ done
+}
+
+ipkg_extract_paragraph() {
+ local pkg="$1"
+ sed -ne "/Package:[[:space:]]*$pkg[[:space:]]*\$/,/^\$/p"
+}
+
+ipkg_extract_field() {
+ local field="$1"
+# blacker magic...
+ sed -ne "
+: TOP
+/^$field:/{
+p
+n
+b FIELD
+}
+d
+: FIELD
+/^$/b TOP
+/^[^[:space:]]/b TOP
+p
+n
+b FIELD
+"
+}
+
+ipkg_extract_value() {
+ sed -e "s/^[^:]*:[[:space:]]*//"
+}
+
+ipkg_require_list() {
+ [ $# -lt 1 ] && return 1
+ local src="$1"
+ if [ ! -f "$IPKG_LISTS_DIR/$src" ]; then
+ echo "ERROR: File not found: $IPKG_LISTS_DIR/$src" >&2
+ echo " You probably want to run \`ipkg update'" >&2
+ return 1
+ fi
+ return 0
+}
+
+ipkg_info() {
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+ case $# in
+ 0)
+ cat $IPKG_LISTS_DIR/$src
+ ;;
+ 1)
+ ipkg_extract_paragraph $1 < $IPKG_LISTS_DIR/$src
+ ;;
+ *)
+ ipkg_extract_paragraph $1 < $IPKG_LISTS_DIR/$src | ipkg_extract_field $2
+ ;;
+ esac
+ fi
+ done
+}
+
+ipkg_status_sd() {
+ [ $# -lt 1 ] && return 0
+ sd="$1"
+ shift
+ if [ -f $sd/status ]; then
+ case $# in
+ 0)
+ cat $sd/status
+ ;;
+ 1)
+ ipkg_extract_paragraph $1 < $sd/status
+ ;;
+ *)
+ ipkg_extract_paragraph $1 < $sd/status | ipkg_extract_field $2
+ ;;
+ esac
+ fi
+ return 0
+}
+
+ipkg_status_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_sd $sd $*
+ done
+}
+
+ipkg_status() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_all $*
+ fi
+}
+
+ipkg_status_matching_sd() {
+ local sd="$1"
+ local re="$2"
+ if [ -f $sd/status ]; then
+ sed -ne "
+: TOP
+/^Package:/{
+s/^Package:[[:space:]]*//
+s/[[:space:]]*$//
+h
+}
+/$re/{
+g
+p
+b NEXT
+}
+d
+: NEXT
+/^$/b TOP
+n
+b NEXT
+" < $sd/status
+ fi
+ return 0
+}
+
+ipkg_status_matching_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_matching_sd $sd $*
+ done
+}
+
+ipkg_status_matching() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_matching_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_matching_all $*
+ fi
+}
+
+ipkg_status_installed_sd() {
+ local sd="$1"
+ local pkg="$2"
+ ipkg_status_sd $sd $pkg Status | grep -q "Status: install ok installed"
+}
+
+ipkg_status_installed_all() {
+ local ret=1
+ for sd in `ipkg_state_dirs`; do
+ if `ipkg_status_installed_sd $sd $*`; then
+ ret=0
+ fi
+ done
+ return $ret
+}
+
+ipkg_status_mentioned_sd() {
+ local sd="$1"
+ local pkg="$2"
+ [ -n "`ipkg_status_sd $sd $pkg Status`" ]
+}
+
+ipkg_files() {
+ local pkg="$1"
+ if [ -n "$DEST_NAME" ]; then
+ dests=$IPKG_ROOT
+ else
+ dests="`ipkg_dests_all`"
+ fi
+ for dest in $dests; do
+ if [ -f $dest/$IPKG_DIR_PREFIX/info/$pkg.list ]; then
+ dest_sed="`echo $dest | ipkg_protect_slashes`"
+ sed -e "s/^/$dest_sed/" < $dest/$IPKG_DIR_PREFIX/info/$pkg.list
+ fi
+ done
+}
+
+ipkg_search() {
+ local pattern="$1"
+
+ for dest_name in `ipkg_dest_names`; do
+ dest="`ipkg_dest_byname $dest_name`"
+ dest_sed="`echo $dest | ipkg_protect_slashes`"
+
+ set +o noglob
+ local list_files="`ls -1 $dest/$IPKG_DIR_PREFIX/info/*.list 2>/dev/null`"
+ set -o noglob
+ for file in $list_files; do
+ if sed "s/^/$dest_sed/" $file | grep -q $pattern; then
+ local pkg="`echo $file | sed "s/^.*\/\(.*\)\.list/\1/"`"
+ [ "$dest_name" != `ipkg_dest_default_name` ] && pkg="$pkg ($dest_name)"
+ sed "s/^/$dest_sed/" $file | grep $pattern | sed "s/^/$pkg: /"
+ fi
+ done
+ done
+}
+
+ipkg_status_remove_sd() {
+ local sd="$1"
+ local pkg="$2"
+
+ if [ ! -f $sd/status ]; then
+ mkdir -p $sd
+ touch $sd/status
+ fi
+ sed -ne "/Package:[[:space:]]*$pkg[[:space:]]*\$/,/^\$/!p" < $sd/status > $sd/status.new
+ mv $sd/status.new $sd/status
+}
+
+ipkg_status_remove_all() {
+ for sd in `ipkg_state_dirs`; do
+ ipkg_status_remove_sd $sd $*
+ done
+}
+
+ipkg_status_remove() {
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_status_remove_sd $IPKG_STATE_DIR $*
+ else
+ ipkg_status_remove_all $*
+ fi
+}
+
+ipkg_status_update_sd() {
+ local sd="$1"
+ local pkg="$2"
+
+ ipkg_status_remove_sd $sd $pkg
+ ipkg_extract_field "$IPKG_STATUS_FIELDS" >> $sd/status
+ echo "" >> $sd/status
+}
+
+ipkg_status_update() {
+ ipkg_status_update_sd $IPKG_STATE_DIR $*
+}
+
+ipkg_unsatisfied_dependences() {
+ local pkg=$1
+ local deps="`ipkg_get_depends $pkg`"
+ local remaining_deps=
+ for dep in $deps; do
+ local installed="`ipkg_get_installed $dep`"
+ if [ "$installed" != "installed" ] ; then
+ remaining_deps="$remaining_deps $dep"
+ fi
+ done
+ ## echo "ipkg_unsatisfied_dependences pkg=$pkg $remaining_deps" > /dev/console
+ echo $remaining_deps
+}
+
+ipkg_safe_pkg_name() {
+ local pkg=$1
+ local spkg="`echo pkg_$pkg | sed -e y/-+./___/`"
+ echo $spkg
+}
+
+ipkg_set_depends() {
+ local pkg=$1; shift
+ local new_deps="$*"
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ ## setvar ${pkg}_depends "$new_deps"
+ echo $new_deps > /tmp/ipkg/${pkg}.depends
+}
+
+ipkg_get_depends() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ cat /tmp/ipkg/${pkg}.depends
+ ## eval "echo \$${pkg}_depends"
+}
+
+ipkg_set_installed() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ echo installed > /tmp/ipkg/${pkg}.installed
+ ## setvar ${pkg}_installed "installed"
+}
+
+ipkg_set_uninstalled() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ ### echo ipkg_set_uninstalled $pkg > /dev/console
+ echo uninstalled > /tmp/ipkg/${pkg}.installed
+ ## setvar ${pkg}_installed "uninstalled"
+}
+
+ipkg_get_installed() {
+ local pkg=$1
+ pkg="`ipkg_safe_pkg_name $pkg`"
+ if [ -f /tmp/ipkg/${pkg}.installed ]; then
+ cat /tmp/ipkg/${pkg}.installed
+ fi
+ ## eval "echo \$${pkg}_installed"
+}
+
+ipkg_depends() {
+ local new_pkgs="$*"
+ local all_deps=
+ local installed_pkgs="`ipkg_status_matching_all 'Status:.*[[:space:]]installed'`"
+ for pkg in $installed_pkgs; do
+ ipkg_set_installed $pkg
+ done
+ while [ -n "$new_pkgs" ]; do
+ all_deps="$all_deps $new_pkgs"
+ local new_deps=
+ for pkg in $new_pkgs; do
+ if echo $pkg | grep -q '[^a-z0-9.+-]'; then
+ echo "ipkg_depends: ERROR: Package name $pkg contains illegal characters (should be [a-z0-9.+-])" >&2
+ return 1
+ fi
+ # TODO: Fix this. For now I am ignoring versions and alternations in dependencies.
+ new_deps="$new_deps "`ipkg_info $pkg '\(Pre-\)\?Depends' | ipkg_extract_value | sed -e 's/([^)]*)//g
+s/\(|[[:space:]]*[a-z0-9.+-]\+[[:space:]]*\)\+//g
+s/,/ /g
+s/ \+/ /g'`
+ ipkg_set_depends $pkg $new_deps
+ done
+
+ new_deps=`echo $new_deps | sed -e 's/[[:space:]]\+/\\
+/g' | sort | uniq`
+
+ local maybe_new_pkgs=
+ for pkg in $new_deps; do
+ if ! echo $installed_pkgs | grep -q "\<$pkg\>"; then
+ maybe_new_pkgs="$maybe_new_pkgs $pkg"
+ fi
+ done
+
+ new_pkgs=
+ for pkg in $maybe_new_pkgs; do
+ if ! echo $all_deps | grep -q "\<$pkg\>"; then
+ if [ -z "`ipkg_info $pkg`" ]; then
+ echo "ipkg_depends: Warning: $pkg mentioned in dependency but no package found in $IPKG_LISTS_DIR" >&2
+ ipkg_set_installed $pkg
+ else
+ new_pkgs="$new_pkgs $pkg"
+ ipkg_set_uninstalled $pkg
+ fi
+ else
+ ipkg_set_uninstalled $pkg
+ fi
+ done
+ done
+
+ echo $all_deps
+}
+
+ipkg_get_install_dest() {
+ local dest="$1"
+ shift
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ local requested_pkgs="$*"
+ local pkgs="`ipkg_depends $*`"
+
+ mkdir -p $info_dir
+ for pkg in $pkgs; do
+ if ! ipkg_status_mentioned_sd $sd $pkg; then
+ echo "Package: $pkg
+Status: install ok not-installed" | ipkg_status_update_sd $sd $pkg
+ fi
+ done
+ ## mark the packages that we were directly requested to install as uninstalled
+ for pkg in $requested_pkgs; do ipkg_set_uninstalled $pkg; done
+
+ local new_pkgs=
+ local pkgs_installed=0
+ while [ -n "pkgs" ]; do
+ curcheck=0
+ ## echo "pkgs to install: {$pkgs}" > /dev/console
+ for pkg in $pkgs; do
+ curcheck="`expr $curcheck + 1`"
+ local is_installed="`ipkg_get_installed $pkg`"
+ if [ "$is_installed" = "installed" ]; then
+ echo "$pkg is installed" > /dev/console
+ continue
+ fi
+
+ local remaining_deps="`ipkg_unsatisfied_dependences $pkg`"
+ if [ -n "$remaining_deps" ]; then
+ new_pkgs="$new_pkgs $pkg"
+ ### echo "Dependences not satisfied for $pkg: $remaining_deps"
+ if [ $curcheck -ne `echo $pkgs|wc -w` ]; then
+ continue
+ fi
+ fi
+
+ local filename=
+ for src in `ipkg_src_names`; do
+ if ipkg_require_list $src; then
+ filename="`ipkg_extract_paragraph $pkg < $IPKG_LISTS_DIR/$src | ipkg_extract_field Filename | ipkg_extract_value`"
+ [ -n "$filename" ] && break
+ fi
+ done
+
+ if [ -z "$filename" ]; then
+ echo "ipkg_get_install: ERROR: Cannot find package $pkg in $IPKG_LISTS_DIR"
+ echo "ipkg_get_install: Check the spelling and maybe run \`ipkg update'."
+ ipkg_status_remove_sd $sd $pkg
+ return 1;
+ fi
+
+ [ -e "$IPKG_TMP" ] || mkdir -p $IPKG_TMP
+
+ echo ""
+ local tmp_pkg_file="$IPKG_TMP/"`ipkg_file_part $filename`
+ if ! ipkg_download `ipkg_src_byname $src`/$filename $tmp_pkg_file; then
+ echo "ipkg_get_install: Perhaps you need to run \`ipkg update'?"
+ return 1
+ fi
+
+ if ! ipkg_install_file_dest $dest $tmp_pkg_file; then
+ echo "ipkg_get_install: ERROR: Failed to install $tmp_pkg_file"
+ echo "ipkg_get_install: I'll leave it there for you to try a manual installation"
+ return 1
+ fi
+
+ ipkg_set_installed $pkg
+ pkgs_installed="`expr $pkgs_installed + 1`"
+ rm $tmp_pkg_file
+ done
+ ### echo "Installed $pkgs_installed package(s) this round"
+ if [ $pkgs_installed -eq 0 ]; then
+ if [ -z "$new_pkgs" ]; then
+ break
+ fi
+ fi
+ pkgs_installed=0
+ pkgs="$new_pkgs"
+ new_pkgs=
+ curcheck=0
+ done
+}
+
+ipkg_get_install() {
+ ipkg_get_install_dest $IPKG_ROOT $*
+}
+
+ipkg_install_file_dest() {
+ local dest="$1"
+ local filename="$2"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ if [ ! -f "$filename" ]; then
+ echo "ipkg_install_file: ERROR: File $filename not found"
+ return 1
+ fi
+
+ local pkg="`ipkg_file_part $filename | sed 's/\([a-z0-9.+-]\+\)_.*/\1/'`"
+ local ext="`echo $filename | sed 's/.*\.//'`"
+ local pkg_extract_stdout
+ if [ "$ext" = "ipk" ]; then
+ pkg_extract_stdout="tar -xzOf"
+ elif [ "$ext" = "deb" ]; then
+ pkg_extract_stdout="ar p"
+ else
+ echo "ipkg_install_file: ERROR: File $filename has unknown extension $ext (not .ipk or .deb)"
+ return 1
+ fi
+
+ # Check dependencies
+ local depends="`ipkg_depends $pkg | sed -e "s/\<$pkg\>//"`"
+
+ # Don't worry about deps that are scheduled for installation
+ local missing_deps=
+ for dep in $depends; do
+ if ! ipkg_status_all $dep | grep -q 'Status:[[:space:]]install'; then
+ missing_deps="$missing_deps $dep"
+ fi
+ done
+
+ if [ ! -z "$missing_deps" ]; then
+ if [ -n "$FORCE_DEPENDS" ]; then
+ echo "ipkg_install_file: Warning: $pkg depends on the following uninstalled programs: $missing_deps"
+ else
+ echo "ipkg_install_file: ERROR: $pkg depends on the following uninstalled programs:
+ $missing_deps"
+ echo "ipkg_install_file: You may want to use \`ipkg install' to install these."
+ return 1
+ fi
+ fi
+
+ mkdir -p $IPKG_TMP/$pkg/control
+ mkdir -p $IPKG_TMP/$pkg/data
+ mkdir -p $info_dir
+
+ if ! $pkg_extract_stdout $filename ./control.tar.gz | (cd $IPKG_TMP/$pkg/control; tar -xzf - ) ; then
+ echo "ipkg_install_file: ERROR unpacking control.tar.gz from $filename"
+ return 1
+ fi
+
+ if [ -n "$IPKG_OFFLINE_ROOT" ]; then
+ if grep -q '^InstallsOffline:[[:space:]]*no' $IPKG_TMP/$pkg/control/control; then
+ echo "*** Warning: Package $pkg may not be installed in offline mode"
+ echo "*** Warning: Scheduling $filename for pending installation (installing into $IPKG_PENDING_DIR)"
+ echo "Package: $pkg
+Status: install ok pending" | ipkg_status_update_sd $sd $pkg
+ mkdir -p $IPKG_PENDING_DIR
+ cp $filename $IPKG_PENDING_DIR
+ rm -r $IPKG_TMP/$pkg/control
+ rm -r $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ return 0
+ fi
+ fi
+
+
+ echo -n "Unpacking $pkg..."
+ set +o noglob
+ for file in $IPKG_TMP/$pkg/control/*; do
+ local base_file="`ipkg_file_part $file`"
+ mv $file $info_dir/$pkg.$base_file
+ done
+ set -o noglob
+ rm -r $IPKG_TMP/$pkg/control
+
+ if ! $pkg_extract_stdout $filename ./data.tar.gz | (cd $IPKG_TMP/$pkg/data; tar -xzf - ) ; then
+ echo "ipkg_install_file: ERROR unpacking data.tar.gz from $filename"
+ return 1
+ fi
+ echo "Done."
+
+ echo -n "Configuring $pkg..."
+ export PKG_ROOT=$dest
+ if [ -x "$info_dir/$pkg.preinst" ]; then
+ if ! $info_dir/$pkg.preinst install; then
+ echo "$info_dir/$pkg.preinst failed. Aborting installation of $pkg"
+ rm -rf $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ return 1
+ fi
+ fi
+
+ local old_conffiles="`ipkg_status_sd $sd $pkg Conffiles | ipkg_extract_value`"
+ local new_conffiles=
+ if [ -f "$info_dir/$pkg.conffiles" ]; then
+ for conffile in `cat $info_dir/$pkg.conffiles`; do
+ if [ -f "$dest/$conffile" ] && ! echo " $old_conffiles " | grep -q " $conffile "`md5sum $dest/$conffile | sed 's/ .*//'`; then
+ local use_maintainers_conffile=
+ if [ -z "$FORCE_DEFAULTS" ]; then
+ while true; do
+ echo -n "Configuration file \`$conffile'
+ ==> File on system created by you or by a script.
+ ==> File also in package provided by package maintainer.
+ What would you like to do about it ? Your options are:
+ Y or I : install the package maintainer's version
+ N or O : keep your currently-installed version
+ D : show the differences between the versions (if diff is installed)
+ The default action is to keep your current version.
+*** `ipkg_file_part $conffile` (Y/I/N/O/D) [default=N] ? "
+ read response
+ case "$response" in
+ [YyIi] | [Yy][Ee][Ss])
+ use_maintainers_conffile=t
+ break
+ ;;
+ [Dd])
+ echo "
+diff -u $dest/$conffile $IPKG_TMP/$pkg/data/$conffile"
+ diff -u $dest/$conffile $IPKG_TMP/$pkg/data/$conffile || true
+ echo "[Press ENTER to continue]"
+ read junk
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+ fi
+ if [ -n "$use_maintainers_conffile" ]; then
+ local md5sum="`md5sum $IPKG_TMP/$pkg/data/$conffile | sed 's/ .*//'`"
+ new_conffiles="$new_conffiles $conffile $md5sum"
+ else
+ new_conffiles="$new_conffiles $conffile <custom>"
+ rm $IPKG_TMP/$pkg/data/$conffile
+ fi
+ else
+ md5sum="`md5sum $IPKG_TMP/$pkg/data/$conffile | sed 's/ .*//'`"
+ new_conffiles="$new_conffiles $conffile $md5sum"
+ fi
+ done
+ fi
+
+ local owd="`pwd`"
+ (cd $IPKG_TMP/$pkg/data/; tar cf - . | (cd $owd; cd $dest; tar xf -))
+ rm -rf $IPKG_TMP/$pkg/data
+ rmdir $IPKG_TMP/$pkg
+ rm -f $info_dir/$pkg.list
+ $pkg_extract_stdout $filename ./data.tar.gz | tar tzf - | sed -e 's/^\.//' > $info_dir/$pkg.list
+
+ if [ -x "$info_dir/$pkg.postinst" ]; then
+ $info_dir/$pkg.postinst configure
+ fi
+
+ if [ -n "$new_conffiles" ]; then
+ new_conffiles='Conffiles: '`echo $new_conffiles | ipkg_protect_slashes`
+ fi
+ local sed_safe_offline_root="`echo ${IPKG_OFFLINE_ROOT} | ipkg_protect_slashes`"
+ local sed_safe_root="`echo $dest | sed -e "s/^${sed_safe_offline_root}//" | ipkg_protect_slashes`"
+ sed -e "s/\(Package:.*\)/\1\\
+Status: install ok installed\\
+Root: ${sed_safe_root}\\
+${new_conffiles}/" $info_dir/$pkg.control | ipkg_status_update_sd $sd $pkg
+
+ rm -f $info_dir/$pkg.control
+ rm -f $info_dir/$pkg.conffiles
+ rm -f $info_dir/$pkg.preinst
+ rm -f $info_dir/$pkg.postinst
+
+ echo "Done."
+}
+
+ipkg_install_file() {
+ ipkg_install_file_dest $IPKG_ROOT $*
+}
+
+ipkg_install() {
+
+ while [ $# -gt 0 ]; do
+ local pkg="$1"
+ shift
+
+ case "$pkg" in
+ http://* | ftp://*)
+ local tmp_pkg_file="$IPKG_TMP/"`ipkg_file_part $pkg`
+ if ipkg_download $pkg $tmp_pkg_file; then
+ ipkg_install_file $tmp_pkg_file
+ rm $tmp_pkg_file
+ fi
+ ;;
+ file:/*.ipk | file://*.deb)
+ local ipkg_filename="`echo $pkg|sed 's/^file://'`"
+ ipkg_install_file $ipkg_filename
+ ;;
+ *.ipk | *.deb)
+ if [ -f "$pkg" ]; then
+ ipkg_install_file $pkg
+ else
+ echo "File not found $pkg" >&2
+ fi
+ ;;
+ *)
+ ipkg_get_install $pkg || true
+ ;;
+ esac
+ done
+}
+
+ipkg_install_pending() {
+ [ -n "$IPKG_OFFLINE_ROOT" ] && return 0
+
+ if [ -d "$IPKG_PENDING_DIR" ]; then
+ set +o noglob
+ local pending="`ls -1d $IPKG_PENDING_DIR/*.ipk 2> /dev/null`" || true
+ set -o noglob
+ if [ -n "$pending" ]; then
+ echo "The following packages in $IPKG_PENDING_DIR will now be installed:"
+ echo $pending
+ for filename in $pending; do
+ if ipkg_install_file $filename; then
+ rm $filename
+ fi
+ done
+ fi
+ fi
+ return 0
+}
+
+ipkg_install_wanted() {
+ local wanted="`ipkg_status_matching 'Status:[[:space:]]*install.*not-installed'`"
+
+ if [ -n "$wanted" ]; then
+ echo "The following package were previously requested but have not been installed:"
+ echo $wanted
+
+ if [ -n "$FORCE_DEFAULTS" ]; then
+ echo "Installing them now."
+ else
+ echo -n "Install them now [Y/n] ? "
+ read response
+ case "$response" in
+ [Nn] | [Nn][Oo])
+ return 0
+ ;;
+ esac
+ fi
+
+ ipkg_install $wanted
+ fi
+
+ return 0
+}
+
+ipkg_upgrade_pkg() {
+ local pkg="$1"
+ local avail_ver="`ipkg_info $pkg Version | ipkg_extract_value | head -1`"
+
+ is_installed=
+ for dest_name in `ipkg_dest_names`; do
+ local dest="`ipkg_dest_byname $dest_name`"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local inst_ver="`ipkg_status_sd $sd $pkg Version | ipkg_extract_value`"
+ if [ -n "$inst_ver" ]; then
+ is_installed=t
+
+ if [ -z "$avail_ver" ]; then
+ echo "Assuming locally installed package $pkg ($inst_ver) is up to date"
+ return 0
+ fi
+
+ if [ "$avail_ver" = "$inst_ver" ]; then
+ echo "Package $pkg ($inst_ver) installed in $dest_name is up to date"
+ elif ipkg_is_upgrade "$avail_ver" "$inst_ver"; then
+ echo "Upgrading $pkg ($dest_name) from $inst_ver to $avail_ver"
+ ipkg_get_install_dest $dest $pkg
+ else
+ echo "Not downgrading package $pkg from $inst_ver to $avail_ver"
+ fi
+ fi
+ done
+
+ if [ -z "$is_installed" ]; then
+ echo "Package $pkg does not appear to be installed"
+ return 0
+ fi
+
+}
+
+ipkg_upgrade() {
+ if [ $# -lt 1 ]; then
+ local pkgs="`ipkg_status_matching 'Status:.*[[:space:]]installed'`"
+ else
+ pkgs="$*"
+ fi
+
+ for pkg in $pkgs; do
+ ipkg_upgrade_pkg $pkg
+ done
+}
+
+ipkg_remove_pkg_dest() {
+ local dest="$1"
+ local pkg="$2"
+ local sd=$dest/$IPKG_DIR_PREFIX
+ local info_dir=$sd/info
+
+ if ! ipkg_status_installed_sd $sd $pkg; then
+ echo "ipkg_remove: Package $pkg does not appear to be installed in $dest"
+ if ipkg_status_mentioned_sd $sd $pkg; then
+ echo "Purging mention of $pkg from the ipkg database"
+ ipkg_status_remove_sd $sd $pkg
+ fi
+ return 1
+ fi
+
+ echo "ipkg_remove: Removing $pkg... "
+
+ local files="`cat $info_dir/$pkg.list`"
+
+ export PKG_ROOT=$dest
+ if [ -x "$info_dir/$pkg.prerm" ]; then
+ $info_dir/$pkg.prerm remove
+ fi
+
+ local conffiles="`ipkg_status_sd $sd $pkg Conffiles | ipkg_extract_value`"
+
+ local dirs_to_remove=
+ for file in $files; do
+ if [ -d "$dest/$file" ]; then
+ dirs_to_remove="$dirs_to_remove $dest/$file"
+ else
+ if echo " $conffiles " | grep -q " $file "; then
+ if echo " $conffiles " | grep -q " $file "`md5sum $dest/$file | sed 's/ .*//'`; then
+ rm -f $dest/$file
+ fi
+ else
+ rm -f $dest/$file
+ fi
+ fi
+ done
+
+ local removed_a_dir=t
+ while [ -n "$removed_a_dir" ]; do
+ removed_a_dir=
+ local new_dirs_to_remove=
+ for dir in $dirs_to_remove; do
+ if rmdir $dir >/dev/null 2>&1; then
+ removed_a_dir=t
+ else
+ new_dirs_to_remove="$new_dirs_to_remove $dir"
+ fi
+ done
+ dirs_to_remove="$new_dirs_to_remove"
+ done
+
+ if [ -n "$dirs_to_remove" ]; then
+ echo "ipkg_remove: Warning: Not removing the following directories since they are not empty:" >&2
+ echo "$dirs_to_remove" | sed -e 's/\/[/]\+/\//g' >&2
+ fi
+
+ if [ -x "$info_dir/$pkg.postrm" ]; then
+ $info_dir/$pkg.postrm remove
+ fi
+
+ ipkg_status_remove_sd $sd $pkg
+ set +o noglob
+ rm -f $info_dir/$pkg.*
+ set -o noglob
+
+ echo "Done."
+}
+
+ipkg_remove_pkg() {
+ local pkg="$1"
+ for dest in `ipkg_dests_all`; do
+ local sd=$dest/$IPKG_DIR_PREFIX
+ if ipkg_status_mentioned_sd $sd $pkg; then
+ ipkg_remove_pkg_dest $dest $pkg
+ fi
+ done
+}
+
+ipkg_remove() {
+ while [ $# -gt 0 ]; do
+ local pkg="$1"
+ shift
+ if [ -n "$DEST_NAME" ]; then
+ ipkg_remove_pkg_dest $IPKG_ROOT $pkg
+ else
+ ipkg_remove_pkg $pkg
+ fi
+ done
+}
+
+###########
+# ipkg main
+###########
+
+# Parse options
+while [ $# -gt 0 ]; do
+ arg="$1"
+ case $arg in
+ -d | -dest)
+ [ $# -gt 1 ] || ipkg_usage "option $arg requires an argument"
+ DEST_NAME="$2"
+ shift
+ ;;
+ -o | -offline)
+ [ $# -gt 1 ] || ipkg_usage "option $arg requires an argument"
+ IPKG_OFFLINE_ROOT="$2"
+ shift
+ ;;
+ -force-depends)
+ FORCE_DEPENDS=t
+ ;;
+ -force-defaults)
+ FORCE_DEFAULTS=t
+ ;;
+ -*)
+ ipkg_usage "unknown option $arg"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+[ $# -lt 1 ] && ipkg_usage "ipkg must have one sub-command argument"
+cmd="$1"
+shift
+
+ipkg_load_configuration
+mkdir -p /tmp/ipkg
+
+case "$cmd" in
+update|upgrade|list|info|status|install_pending)
+ ;;
+install|depends|remove|files|search)
+ [ $# -lt 1 ] && ipkg_usage "ERROR: the \`\`$cmd'' command requires an argument"
+ ;;
+*)
+ echo "ERROR: unknown sub-command \`$cmd'"
+ ipkg_usage
+ ;;
+esac
+
+# Only install pending if we have an interactive sub-command
+case "$cmd" in
+upgrade|install)
+ ipkg_install_pending
+ ipkg_install_wanted
+ ;;
+esac
+
+ipkg_$cmd $*
+for a in `ls $IPKG_TMP`; do
+ rm -rf $IPKG_TMP/$a
+done
Added: trunk/buildroot/package/ipkg/ipkg.mk
===================================================================
--- trunk/buildroot/package/ipkg/ipkg.mk (rev 0)
+++ trunk/buildroot/package/ipkg/ipkg.mk 2007-06-08 15:06:56 UTC (rev 605)
@@ -0,0 +1,107 @@
+#############################################################
+#
+# ipkg: a package management tool
+#
+#############################################################
+
+IPKG_NAME:=ipkg
+IPKG_VERSION:=0.99.149
+IPKG_RELEASE:=2
+IPKG_MD5SUM:=975cc419d6db5fb279dc58177c68373b
+
+# IPKG_SOURCE_URL:=http://www.handhelds.org/packages/ipkg \
+# http://www.gtlib.gatech.edu/pub/handhelds.org/packages/ipkg \
+# http://ftp.gwdg.de/pub/linux/handhelds/packages/ipkg
+IPKG_SITE:=http://ftp.gwdg.de/pub/linux/handhelds/packages/ipkg
+IPKG_SOURCE:=$(IPKG_NAME)-$(IPKG_VERSION).tar.gz
+IPKG_CAT:=zcat
+
+IPKG_BUILD_DIR:=$(BUILD_DIR)/$(IPKG_NAME)-$(IPKG_VERSION)
+IPKG_INSTALL_DIR:=$(IPKG_BUILD_DIR)/ipkg-install
+CP:="cp -f"
+
+
+$(DL_DIR)/$(IPKG_SOURCE):
+ $(WGET) -P $(DL_DIR) $(IPKG_SITE)/$(IPKG_SOURCE)
+
+ipkg-source: $(DL_DIR)/$(IPKG_SOURCE)
+
+$(IPKG_BUILD_DIR)/.unpacked: $(DL_DIR)/$(IPKG_SOURCE)
+ $(IPKG_CAT) $(DL_DIR)/$(IPKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $@
+
+$(IPKG_BUILD_DIR)/.patched: $(IPKG_BUILD_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(IPKG_BUILD_DIR) package/ipkg/patches \*.patch
+ touch $@
+
+$(IPKG_BUILD_DIR)/.configured: $(IPKG_BUILD_DIR)/.patched
+ (cd $(IPKG_BUILD_DIR); rm -rf config.{cache,status} ; \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
+ LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --program-prefix="" \
+ --program-suffix="" \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --bindir=/bin \
+ --datadir=/usr/share \
+ --includedir=/usr/include \
+ --infodir=/usr/share/info \
+ --libdir=/usr/lib \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --mandir=/usr/share/man \
+ --sbindir=/usr/sbin \
+ --sysconfdir=/etc \
+ $(DISABLE_LARGEFILE) \
+ $(DISABLE_NLS) \
+ )
+ touch $@
+
+$(IPKG_BUILD_DIR)/.compiled: $(IPKG_BUILD_DIR)/.configured
+ rm -rf $(IPKG_INSTALL_DIR)
+ mkdir -p $(IPKG_INSTALL_DIR)
+ $(MAKE) -C $(IPKG_BUILD_DIR) \
+ CC=$(TARGET_CC) \
+ DESTDIR="$(IPKG_INSTALL_DIR)" \
+ all install
+ touch $@
+
+ipkg-c: uclibc $(IPKG_BUILD_DIR)/.compiled
+ cp $(IPKG_INSTALL_DIR)/bin/ipkg-cl $(TARGET_DIR)/bin/ipkg
+ -$(STRIP) --strip-unneeded $(IPKG_INSTALL_DIR)/usr/lib/libipkg.so*
+ cp -P $(IPKG_INSTALL_DIR)/usr/lib/libipkg.so* $(TARGET_DIR)/usr/lib/
+# $(RSTRIP) $(IDIR_IPKG_C)
+# $(IPKG_BUILD) $(IDIR_IPKG_C) $(PACKAGE_DIR)
+
+ipkg-sh: uclibc
+ install -m0755 ./package/ipkg/files/ipkg $(TARGET_DIR)/bin/ipkg
+# $(IPKG_BUILD) $(IDIR_IPKG_SH) $(PACKAGE_DIR)
+
+ipkg-clean:
+ rm -f $(TARGET_DIR)/bin/ipkg
+ rm -f $(TARGET_DIR)/usr/lib/libipkg.so*
+ $(MAKE) -C $(IPKG_BUILD_DIR) clean
+ rm $(IPKG_BUILD_DIR)/.compiled
+
+ipkg-dirclean:
+ rm -f $(TARGET_DIR)/bin/ipkg
+ rm -f $(TARGET_DIR)/usr/lib/libipkg.so*
+ rm -rf $(IPKG_BUILD_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_IPKG_C)),y)
+TARGETS+=ipkg-c
+endif
+ifeq ($(strip $(BR2_PACKAGE_IPKG_SH)),y)
+TARGETS+=ipkg-sh
+endif
Added: trunk/buildroot/package/ipkg/patches/no-diff.patch
===================================================================
--- trunk/buildroot/package/ipkg/patches/no-diff.patch (rev 0)
+++ trunk/buildroot/package/ipkg/patches/no-diff.patch 2007-06-08 15:06:56 UTC (rev 605)
@@ -0,0 +1,35 @@
+diff -Nur ipkg-0.99.149.orig/ipkg_install.c ipkg-0.99.149/ipkg_install.c
+--- ipkg-0.99.149.orig/ipkg_install.c 2005-03-30 14:08:13.000000000 +0200
++++ ipkg-0.99.149/ipkg_install.c 2005-09-12 17:37:53.287558000 +0200
+@@ -1416,9 +1416,8 @@
+ " What would you like to do about it ? Your options are:\n"
+ " Y or I : install the package maintainer's version\n"
+ " N or O : keep your currently-installed version\n"
+- " D : show the differences between the versions (if diff is installed)\n"
+ " The default action is to keep your current version.\n"
+- " *** %s (Y/I/N/O/D) [default=N] ? ", file_name, short_file_name);
++ " *** %s (Y/I/N/O) [default=N] ? ", file_name, short_file_name);
+ if (strcmp(response, "y") == 0
+ || strcmp(response, "i") == 0
+ || strcmp(response, "yes") == 0) {
+@@ -1426,20 +1425,6 @@
+ return 0;
+ }
+
+- if (strcmp(response, "d") == 0) {
+- char *cmd;
+-
+- free(response);
+- /* XXX: BUG rewrite to use exec or busybox's internal diff */
+- sprintf_alloc(&cmd, "diff -u %s %s", backup, file_name);
+- xsystem(cmd);
+- free(cmd);
+- printf(" [Press ENTER to continue]\n");
+- response = file_read_line_alloc(stdin);
+- free(response);
+- continue;
+- }
+-
+ free(response);
+ return 1;
+ }
Added: trunk/patches/020-buildroot-ipkg.diff
===================================================================
--- trunk/patches/020-buildroot-ipkg.diff (rev 0)
+++ trunk/patches/020-buildroot-ipkg.diff 2007-06-08 15:06:56 UTC (rev 605)
@@ -0,0 +1,10 @@
+--- buildroot/package/Config.in.old 2007-06-08 17:01:07.000000000 +0200
++++ buildroot/package/Config.in 2007-06-08 17:01:37.000000000 +0200
+@@ -61,6 +61,7 @@
+ source "package/hotplug/Config.in"
+ source "package/imxregs/Config.in"
+ source "package/iostat/Config.in"
++source "package/ipkg/Config.in"
+ source "package/iproute2/Config.in"
+ source "package/ipsec-tools/Config.in"
+ source "package/iptables/Config.in"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|