git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1264 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-11-02 19:09:53 +00:00
parent 639d957e5e
commit c98a36e315
7 changed files with 53 additions and 35 deletions

View File

@ -301,9 +301,13 @@ void spi_lld_unselect(SPIDriver *spip) {
* @details This function performs a simultaneous transmit/receive operation.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to exchange
* @param rxbuf the pointer to the receive buffer
* @param txbuf the pointer to the transmit buffer
* @param[in] n number of words to exchange
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.
@ -311,7 +315,7 @@ void spi_lld_unselect(SPIDriver *spip) {
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*/
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
@ -323,8 +327,10 @@ msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
* @brief Sends data ever the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to send
* @param txbuf the pointer to the transmit buffer
* @param[in] n number of words to send
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.
@ -344,8 +350,10 @@ msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
* @brief Receives data from the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to receive
* @param rxbuf the pointer to the receive buffer
* @param[in] n number of words to receive
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.

View File

@ -186,7 +186,7 @@ extern "C" {
void spi_lld_stop(SPIDriver *spip);
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf);
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf);
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
#ifdef __cplusplus

View File

@ -125,19 +125,15 @@ void spiUnselect(SPIDriver *spip) {
* @details This function performs a simultaneous transmit/receive operation.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to be exchanged
* @param rxbuf the pointer to the receive buffer, if @p NULL is specified then
* the input data is discarded.
* Note that the buffer is organized as an uint8_t array for
* data sizes below or equal to 8 bits else it is organized as
* an uint16_t array.
* @param txbuf the pointer to the transmit buffer, if @p NULL is specified all
* ones are transmitted.
* Note that the buffer is organized as an uint8_t array for
* data sizes below or equal to 8 bits else it is organized as
* an uint16_t array.
* @param[in] n number of words to be exchanged
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
*/
msg_t spiExchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
msg_t spiExchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf) {
chDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL) && (txbuf != NULL),
"spiExchange");
@ -145,15 +141,17 @@ msg_t spiExchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
"spiExchange(), #1",
"not active");
return spi_lld_exchange(spip, n, rxbuf, txbuf);
return spi_lld_exchange(spip, n, txbuf, rxbuf);
}
/**
* @brief Sends data ever the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to send
* @param txbuf the pointer to the transmit buffer
* @param[in] n number of words to send
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.
@ -176,8 +174,10 @@ msg_t spiSend(SPIDriver *spip, size_t n, void *txbuf) {
* @brief Receives data from the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to receive
* @param rxbuf the pointer to the receive buffer
* @param[in] n number of words to receive
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.

View File

@ -59,7 +59,7 @@ extern "C" {
void spiStop(SPIDriver *spip);
void spiSelect(SPIDriver *spip);
void spiUnselect(SPIDriver *spip);
msg_t spiExchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf);
msg_t spiExchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
msg_t spiSend(SPIDriver *spip, size_t n, void *txbuf);
msg_t spiReceive(SPIDriver *spip, size_t n, void *rxbuf);
#if SPI_USE_MUTUAL_EXCLUSION

View File

@ -92,9 +92,13 @@ void spi_lld_unselect(SPIDriver *spip) {
* @details This function performs a simultaneous transmit/receive operation.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to exchange
* @param rxbuf the pointer to the receive buffer
* @param txbuf the pointer to the transmit buffer
* @param[in] n number of words to exchange
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.
@ -110,8 +114,10 @@ msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
* @brief Sends data ever the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to send
* @param txbuf the pointer to the transmit buffer
* @param[in] n number of words to send
* @param[in] txbuf the pointer to the transmit buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.
@ -127,8 +133,10 @@ msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
* @brief Receives data from the SPI bus.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param n number of words to receive
* @param rxbuf the pointer to the receive buffer
* @param[in] n number of words to receive
* @param[out] rxbuf the pointer to the receive buffer. Note that the buffer is
* organized as an uint8_t array for data sizes below or equal
* to 8 bits else it is organized as an uint16_t array.
* @return The operation status is returned.
* @retval RDY_OK operation complete.
* @retval RDY_RESET hardware failure.

View File

@ -94,7 +94,7 @@ extern "C" {
void spi_lld_stop(SPIDriver *spip);
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf);
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *txbuf, void *rxbuf);
msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf);
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
#ifdef __cplusplus

View File

@ -88,6 +88,8 @@ void SVCallVector(Thread *otp, Thread *ntp) {
/* pop the registers from the PSP stack */
/* set the PSP from r12 */
/* set the BASEPRI from R3 */
(void)otp;
(void)ntp;
#ifdef CH_CURRP_REGISTER_CACHE
asm volatile ("mrs r3, BASEPRI \n\t" \
"mrs r12, PSP \n\t" \