csa.c (230602) | csa.c (230897) |
---|---|
1/*- 2 * Copyright (c) 1999 Seigo Tanimura 3 * All rights reserved. 4 * 5 * Portions of this source are based on cwcealdr.cpp and dhwiface.cpp in 6 * cwcealdr1.zip, the sample sources by Crystal Semiconductor. 7 * Copyright (c) 1996-1998 Crystal Semiconductor Corp. 8 * --- 36 unchanged lines hidden (view full) --- 45#include <dev/sound/pcm/sound.h> 46#include <dev/sound/chip.h> 47#include <dev/sound/pci/csareg.h> 48#include <dev/sound/pci/csavar.h> 49 50#include <dev/pci/pcireg.h> 51#include <dev/pci/pcivar.h> 52 | 1/*- 2 * Copyright (c) 1999 Seigo Tanimura 3 * All rights reserved. 4 * 5 * Portions of this source are based on cwcealdr.cpp and dhwiface.cpp in 6 * cwcealdr1.zip, the sample sources by Crystal Semiconductor. 7 * Copyright (c) 1996-1998 Crystal Semiconductor Corp. 8 * --- 36 unchanged lines hidden (view full) --- 45#include <dev/sound/pcm/sound.h> 46#include <dev/sound/chip.h> 47#include <dev/sound/pci/csareg.h> 48#include <dev/sound/pci/csavar.h> 49 50#include <dev/pci/pcireg.h> 51#include <dev/pci/pcivar.h> 52 |
53#include <gnu/dev/sound/pci/csaimg.h> | 53#include <dev/sound/pci/cs461x_dsp.h> |
54 | 54 |
55SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/csa.c 230602 2012-01-26 21:43:11Z pfg $"); | 55SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/csa.c 230897 2012-02-01 21:38:01Z pfg $"); |
56 57/* This is the pci device id. */ 58#define CS4610_PCI_ID 0x60011013 59#define CS4614_PCI_ID 0x60031013 60#define CS4615_PCI_ID 0x60041013 61 62/* Here is the parameter structure per a device. */ 63struct csa_softc { --- 26 unchanged lines hidden (view full) --- 90 driver_filter_t *filter, 91#endif 92 driver_intr_t *intr, void *arg, void **cookiep); 93static int csa_teardown_intr(device_t bus, device_t child, 94 struct resource *irq, void *cookie); 95static driver_intr_t csa_intr; 96static int csa_initialize(sc_p scp); 97static int csa_downloadimage(csa_res *resp); | 56 57/* This is the pci device id. */ 58#define CS4610_PCI_ID 0x60011013 59#define CS4614_PCI_ID 0x60031013 60#define CS4615_PCI_ID 0x60041013 61 62/* Here is the parameter structure per a device. */ 63struct csa_softc { --- 26 unchanged lines hidden (view full) --- 90 driver_filter_t *filter, 91#endif 92 driver_intr_t *intr, void *arg, void **cookiep); 93static int csa_teardown_intr(device_t bus, device_t child, 94 struct resource *irq, void *cookie); 95static driver_intr_t csa_intr; 96static int csa_initialize(sc_p scp); 97static int csa_downloadimage(csa_res *resp); |
98static int csa_transferimage(csa_res *resp, u_int32_t *src, u_long dest, u_long len); |
|
98 99static devclass_t csa_devclass; 100 101static void 102amp_none(void) 103{ 104} 105 --- 749 unchanged lines hidden (view full) --- 855 * Set the frame timer to reflect the number of cycles per frame. 856 */ 857 csa_writemem(resp, BA1_FRMT, 0xadf); 858} 859 860static int 861csa_downloadimage(csa_res *resp) 862{ | 99 100static devclass_t csa_devclass; 101 102static void 103amp_none(void) 104{ 105} 106 --- 749 unchanged lines hidden (view full) --- 856 * Set the frame timer to reflect the number of cycles per frame. 857 */ 858 csa_writemem(resp, BA1_FRMT, 0xadf); 859} 860 861static int 862csa_downloadimage(csa_res *resp) 863{ |
863 int i; 864 u_int32_t tmp, src, dst, count; | 864 int ret; 865 u_long ul, offset; |
865 | 866 |
866 for (i = 0; i < CLEAR__COUNT; i++) { 867 dst = ClrStat[i].BA1__DestByteOffset; 868 count = ClrStat[i].BA1__SourceSize; 869 for (tmp = 0; tmp < count; tmp += 4) 870 csa_writemem(resp, dst + tmp, 0x00000000); | 867 for (ul = 0, offset = 0 ; ul < INKY_MEMORY_COUNT ; ul++) { 868 /* 869 * DMA this block from host memory to the appropriate 870 * memory on the CSDevice. 871 */ 872 ret = csa_transferimage(resp, 873 cs461x_firmware.BA1Array + offset, 874 cs461x_firmware.MemoryStat[ul].ulDestAddr, 875 cs461x_firmware.MemoryStat[ul].ulSourceSize); 876 if (ret) 877 return (ret); 878 offset += cs461x_firmware.MemoryStat[ul].ulSourceSize >> 2; |
871 } | 879 } |
880 return (0); 881} |
|
872 | 882 |
873 for (i = 0; i < FILL__COUNT; i++) { 874 src = 0; 875 dst = FillStat[i].Offset; 876 count = FillStat[i].Size; 877 for (tmp = 0; tmp < count; tmp += 4) { 878 csa_writemem(resp, dst + tmp, FillStat[i].pFill[src]); 879 src++; 880 } 881 } | 883static int 884csa_transferimage(csa_res *resp, u_int32_t *src, u_long dest, u_long len) 885{ 886 u_long ul; 887 888 /* 889 * We do not allow DMAs from host memory to host memory (although the DMA 890 * can do it) and we do not allow DMAs which are not a multiple of 4 bytes 891 * in size (because that DMA can not do that). Return an error if either 892 * of these conditions exist. 893 */ 894 if ((len & 0x3) != 0) 895 return (EINVAL); |
882 | 896 |
897 /* Check the destination address that it is a multiple of 4 */ 898 if ((dest & 0x3) != 0) 899 return (EINVAL); 900 901 /* Write the buffer out. */ 902 for (ul = 0 ; ul < len ; ul += 4) 903 csa_writemem(resp, dest + ul, src[ul >> 2]); |
|
883 return (0); 884} 885 886int 887csa_readcodec(csa_res *resp, u_long offset, u_int32_t *data) 888{ 889 int i; 890 u_int32_t acctl, acsts; --- 209 unchanged lines hidden --- | 904 return (0); 905} 906 907int 908csa_readcodec(csa_res *resp, u_long offset, u_int32_t *data) 909{ 910 int i; 911 u_int32_t acctl, acsts; --- 209 unchanged lines hidden --- |