📄 mcbspdrv.h
字号:
/* */
/******************************************************************************/
Mcbsp_dev mcbsp_open( /*RET: initialized Mcbsp_dev or NULL */
int port /*IN: port number (0 or 1) to open */
);
/******************************************************************************/
/* MCBSP_CLOSE - Flag MCBSP port as CLOSED. */
/******************************************************************************/
void mcbsp_close(Mcbsp_dev dev /* IN: open device handle to close */
);
/******************************************************************************/
/* MCBSP_CONFIG - Configure a MCBSP port. */
/* */
/* This function performs configuration by writing to applicable fields */
/* within the SPCR, PCR, RCR, XCR and SRGR. The MCCR (Multi-channel */
/* Control Register) is configured by the mcbsp_mc_config() routine. */
/* Note: MCBSP config will take the indicated sections out of operation */
/* by clearing X/RRST to 0 for the receiver and transmitter, */
/* respectively. */
/* */
/******************************************************************************/
int mcbsp_config( /* RET: OK or ERROR */
Mcbsp_dev dev, /* IN:MCBSP handle */
Mcbsp_config *p_mcbsp_config /* IN:MCBSP configuration dat */
);
/******************************************************************************/
/* MCBSP_MC_CONFIG - Configure multi-channel selection operation */
/* */
/* This function performs multi-channel selection configuration by */
/* writing to the applicable fields in MCCR, RCER, and XCER. */
/* */
/******************************************************************************/
int mcbsp_mc_config( /* RET: OK or ERROR */
Mcbsp_dev dev, /* IN:MCBSP handle */
Mcbsp_mc_config *p_mcbsp_mc_config /* IN:MCBSP mc config data */
);
/*****************************************************************************/
/* MCBSP_RESET - Resets all McBSP registers to their POR values */
/* */
/* This routine will reset all McBSP memory mapped registers to their */
/* Power On Reset (POR) values. */
/*****************************************************************************/
void mcbsp_reset(Mcbsp_dev dev);
/*****************************************************************************/
/* MCBSP_STOP - Stop tx, rx, sample rate & frame sync generators */
/* */
/* This routine will place the transmit, receive and sample rate */
/* generator of the selected MCBSP port into reset (disabled) state. */
/*****************************************************************************/
void mcbsp_stop(Mcbsp_dev dev);
/******************************************************************************/
/* MCBSP_SYNC_RECEIVE- Rx a buffer of data from MCBSP,blocking until complete*/
/* */
/* This routine performs a simple blocking CPU read from the DRR register */
/* of the selected MCBSP port. This function does not return until */
/* num_bytes of data have been transferred to *p_buffer. Note that the */
/* argument num_bytes refers to the number of bytes transferred to */
/* p_buffer rather than the number of words read from DRR. Argument */
/* pack_data may be set to TRUE so that the minimum number of bytes will */
/* be used to represent the data words read. The pack_data argument is */
/* only applicable in single phase transfers, and will cause this function*/
/* to return ERROR if TRUE and the port is configured for multiphase. */
/* */
/******************************************************************************/
int mcbsp_sync_receive(
Mcbsp_dev dev,
unsigned char *p_buffer,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
int pack_data
);
/******************************************************************************/
/* MCBSP_ASYNC_RECEIVE - Asynchronous Receive on MCBSP */
/* */
/* This function sets up a DMA transfer and enables the DMA block complete*/
/* interrupt whose ISR calls the indicated read callback function. */
/******************************************************************************/
int mcbsp_async_receive(
Mcbsp_dev dev,
unsigned char *p_buffer,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
Callback *p_ract
);
/******************************************************************************/
/* MCBSP_SYNC_SEND - Writes a buffer of data from MCBSP */
/* */
/* This routine performs a simple blocking CPU write to the DXR register */
/* of the selected MCBSP port. This function does not return until */
/* num_bytes of data have been transmitted from p_buffer. Note that the */
/* argument num_bytes refers to the number of bytes to be transmitted */
/* rather than the number of words written to DXR. Argument */
/* packed_data may be set to TRUE to indicate that only the significant */
/* bytes of each word to be transmitted reside in p_buffer. The size of */
/* the data words is determined from WDLEN1 in SPCR. Multiphase packed */
/* transmits are currently not supported. If the selected transmitter has*/
/* been configured for multiphase mode and packed_data is TRUE, this */
/* function will return ERROR status. */
/* */
/******************************************************************************/
int mcbsp_sync_send(
Mcbsp_dev dev,
unsigned char *p_buffer,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
int packed_data);
/******************************************************************************/
/* MCBSP_ASYNC_SEND - Asynchronous DMA driven send with ISR call to Write */
/* callback function. */
/* */
/******************************************************************************/
int mcbsp_async_send(
Mcbsp_dev dev,
unsigned char *p_buffer,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
Callback *p_wact
);
/******************************************************************************/
/* MCBSP_CONT_ASYNC_SEND - Asynchronous DMA driven continuous send with ISR */
/* call to callback function. */
/* */
/* This routine extends the functionality of the mcbsp_async_send() by */
/* providing continuous mode operation via the autoinitialization capability */
/* of the DMA controller. Both continuous (ping-pong) operation and */
/* repetitive (replay) operation is supported. */
/* */
/******************************************************************************/
int mcbsp_cont_async_send(
Mcbsp_dev dev,
unsigned char *p_ping_buff,
unsigned char *p_pong_buff,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
Callback *p_wact
);
/******************************************************************************/
/* MCBSP_CONT_ASYNC_RECEIVE - Asynchronous DMA driven continuous receive */
/* with ISR call to callback function. */
/* */
/* This routine extends the functionality of the mcbsp_async_recieve() by */
/* providing continuous mode operation via the autoinitialization capability */
/* of the DMA controller. Both continuous (ping-pong) operation and */
/* repetitive (replay) operation is supported. */
/* */
/******************************************************************************/
int mcbsp_cont_async_receive(
Mcbsp_dev dev,
unsigned char *p_ping_buff,
unsigned char *p_pong_buff,
unsigned int num_bytes,
unsigned int frame_sync_enable,
Mcbsp_dev frame_sync_dev,
Callback *p_wact
);
/******************************************************************************/
/* MCBSP_DMA_ESIZE_CONFIG - Configure DMA element transfer size */
/* */
/* This routine allows the element size of DMA transfers to be reconfigured */
/* to 8, 16, or 32 bits. Valid values are DMA_ESIZE8, DMA_ESIZE16 and */
/* DMA_ESIZE32. All subsequent calls to mcbsp_async_receive(), */
/* mcbsp_async_send(), and mcbsp_cont_async_send() will operate with the */
/* defined element size. */
/******************************************************************************/
static void mcbsp_dma_esize_config(
Mcbsp_dev dev,
unsigned char esize
);
#endif /* _MCBSP_DRV_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -