00001
00019 #ifndef _kz_device_h_
00020 #define _kz_device_h_
00021
00022
00023 #include "kernel.h"
00024 #include "cdefBF533.h"
00025
00026
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00033 typedef enum { KZDEV_SPI_8BIT, KZDEV_SPI_16BIT } KZDEV_SPI_BITLEN_t;
00034 int kzdev_spi_regist( KZDEV_SPI_BITLEN_t nBitLen, UW dwBps, int nCS, BOOL bCPOL, BOOL bCPHA );
00035 UW kzdev_spi_chgbps( int nID, UW dwBps );
00036 void kzdev_spi_open(void);
00037 void kzdev_spi_close(void);
00038 int kzdev_spi_readwrite(int nID, const void* pTx, int nTx, void* pRx, int nRx );
00039 int kzdev_spi_read( int nID, void* pRx, int nRx );
00040 int kzdev_spi_write(int nID, const void* pTx, int nTx );
00041 int kzdev_spi_dma_read( int nID, void* pRx, int nRx );
00042 int kzdev_spi_dma_write(int nID, const void* pTx, int nTx );
00043
00044
00045 void kzdev_mems_att_ini(void);
00046 BOOL kzdev_mems_start(void);
00047 void kzdev_mems_stop(void);
00048 BOOL kzdev_mems_isReady(void);
00049 void kzdev_mems_getVal( int *x, int *y, int *z );
00050
00051
00052 void kzdev_mmc_att_ini(void);
00053 void disk_timerproc(void);
00054
00055
00056 BOOL kzdev_audio_start(void *fnCbk, long lSampleRate, int nBlocks, int nChannels );
00057 void kzdev_audio_stop(void);
00058
00059
00060 void kzdev_codec_att_ini(void);
00061 void kzdev_codec_start_DSPMODE(long lSampleRate);
00062 void kzdev_codec_start_I2CMODE(long lSampleRate);
00063 void kzdev_codec_stop(void);
00064
00065
00066 #ifdef __cplusplus
00067 }
00068 #endif
00069
00070
00071
00072 #define KZ_GPIO_SET_DIR_OUT(no) do { *pFIO_DIR |= (1<<no ); *pFIO_INEN &= ~(1<<no); }while(0)
00073 #define KZ_GPIO_SET_DIR_IN(no) do { *pFIO_DIR &= ~(1<<no ); *pFIO_INEN |= (1<<no); }while(0)
00074 #define KZ_GPIO_SET_HI(no) do { *pFIO_FLAG_S = (1<<no); }while(0)
00075 #define KZ_GPIO_SET_LO(no) do { *pFIO_FLAG_C = (1<<no); }while(0)
00076 #define KZ_GPIO_SET_TGL(no) do { *pFIO_FLAG_T = (1<<no); }while(0)
00077 #define KZ_GPIO_GET(no) *pFIO_FLAG_D & ( 1 << no )
00078
00079
00080
00081 #endif