Lines Matching refs:context

36 static void HandleTransmit(CySCB_Type *base, cy_stc_scb_spi_context_t *context);
37 static void HandleReceive (CySCB_Type *base, cy_stc_scb_spi_context_t *context);
68 …PI_Init(CySCB_Type *base, cy_stc_scb_spi_config_t const *config, cy_stc_scb_spi_context_t *context) in Cy_SCB_SPI_Init() argument
183 if (NULL != context) in Cy_SCB_SPI_Init()
185 context->status = 0UL; in Cy_SCB_SPI_Init()
187 context->txBufIdx = 0UL; in Cy_SCB_SPI_Init()
188 context->rxBufIdx = 0UL; in Cy_SCB_SPI_Init()
190 context->cbEvents = NULL; in Cy_SCB_SPI_Init()
196 context->initKey = CY_SCB_SPI_INIT_KEY; in Cy_SCB_SPI_Init()
277 void Cy_SCB_SPI_Disable(CySCB_Type *base, cy_stc_scb_spi_context_t *context) in Cy_SCB_SPI_Disable() argument
281 if (NULL != context) in Cy_SCB_SPI_Disable()
283 context->status = 0UL; in Cy_SCB_SPI_Disable()
285 context->rxBufIdx = 0UL; in Cy_SCB_SPI_Disable()
286 context->txBufIdx = 0UL; in Cy_SCB_SPI_Disable()
359 cy_stc_scb_spi_context_t *locContext = (cy_stc_scb_spi_context_t *) callbackParams->context; in Cy_SCB_SPI_DeepSleepCallback()
532 cy_stc_scb_spi_context_t *locContext = (cy_stc_scb_spi_context_t *) callbackParams->context; in Cy_SCB_SPI_HibernateCallback()
666 cy_stc_scb_spi_context_t *context) in Cy_SCB_SPI_Transfer() argument
668 CY_ASSERT_L1(NULL != context); in Cy_SCB_SPI_Transfer()
670 CY_ASSERT_L1(CY_SCB_SPI_INIT_KEY == context->initKey); in Cy_SCB_SPI_Transfer()
677 if (0UL == (CY_SCB_SPI_TRANSFER_ACTIVE & context->status)) in Cy_SCB_SPI_Transfer()
682 context->status = CY_SCB_SPI_TRANSFER_ACTIVE; in Cy_SCB_SPI_Transfer()
684 context->txBuf = txBuffer; in Cy_SCB_SPI_Transfer()
685 context->txBufSize = size; in Cy_SCB_SPI_Transfer()
686 context->txBufIdx = 0UL; in Cy_SCB_SPI_Transfer()
688 context->rxBuf = rxBuffer; in Cy_SCB_SPI_Transfer()
689 context->rxBufSize = size; in Cy_SCB_SPI_Transfer()
690 context->rxBufIdx = 0UL; in Cy_SCB_SPI_Transfer()
762 void Cy_SCB_SPI_AbortTransfer(CySCB_Type *base, cy_stc_scb_spi_context_t *context) in Cy_SCB_SPI_AbortTransfer() argument
783 context->status = 0UL; in Cy_SCB_SPI_AbortTransfer()
807 …nt32_t Cy_SCB_SPI_GetNumTransfered(CySCB_Type const *base, cy_stc_scb_spi_context_t const *context) in Cy_SCB_SPI_GetNumTransfered() argument
812 return (context->rxBufIdx); in Cy_SCB_SPI_GetNumTransfered()
841 …t32_t Cy_SCB_SPI_GetTransferStatus(CySCB_Type const *base, cy_stc_scb_spi_context_t const *context) in Cy_SCB_SPI_GetTransferStatus() argument
846 return (context->status); in Cy_SCB_SPI_GetTransferStatus()
868 void Cy_SCB_SPI_Interrupt(CySCB_Type *base, cy_stc_scb_spi_context_t *context) in Cy_SCB_SPI_Interrupt() argument
882 context->status |= CY_SCB_SPI_SLAVE_TRANSFER_ERR; in Cy_SCB_SPI_Interrupt()
891 context->status |= CY_SCB_SPI_TRANSFER_OVERFLOW; in Cy_SCB_SPI_Interrupt()
900 context->status |= CY_SCB_SPI_TRANSFER_UNDERFLOW; in Cy_SCB_SPI_Interrupt()
908 if (NULL != context->cbEvents) in Cy_SCB_SPI_Interrupt()
910 context->cbEvents(CY_SCB_SPI_TRANSFER_ERR_EVENT); in Cy_SCB_SPI_Interrupt()
917 HandleReceive(base, context); in Cy_SCB_SPI_Interrupt()
925 HandleTransmit(base, context); in Cy_SCB_SPI_Interrupt()
933 if ((0UL != (context->status & CY_SCB_SPI_TRANSFER_ACTIVE)) && in Cy_SCB_SPI_Interrupt()
934 (0UL == context->rxBufSize) && (0UL == context->txBufSize)) in Cy_SCB_SPI_Interrupt()
937 context->status &= (uint32_t) ~CY_SCB_SPI_TRANSFER_ACTIVE; in Cy_SCB_SPI_Interrupt()
939 if (NULL != context->cbEvents) in Cy_SCB_SPI_Interrupt()
941 context->cbEvents(CY_SCB_SPI_TRANSFER_CMPLT_EVENT); in Cy_SCB_SPI_Interrupt()
963 static void HandleReceive(CySCB_Type *base, cy_stc_scb_spi_context_t *context) in HandleReceive() argument
972 if (numToCopy > context->rxBufSize) in HandleReceive()
974 numToCopy = context->rxBufSize; in HandleReceive()
978 context->rxBufIdx += numToCopy; in HandleReceive()
979 context->rxBufSize -= numToCopy; in HandleReceive()
982 if (NULL != context->rxBuf) in HandleReceive()
984 uint8_t *buf = (uint8_t *) context->rxBuf; in HandleReceive()
986 Cy_SCB_ReadArrayNoCheck(base, context->rxBuf, numToCopy); in HandleReceive()
994 context->rxBuf = (void *) buf; in HandleReceive()
1002 if (0UL == context->rxBufSize) in HandleReceive()
1012 if (context->rxBufSize < level) in HandleReceive()
1014 Cy_SCB_SetRxFifoLevel(base, (context->rxBufSize - 1UL)); in HandleReceive()
1036 static void HandleTransmit(CySCB_Type *base, cy_stc_scb_spi_context_t *context) in HandleTransmit() argument
1047 if (numToCopy > context->txBufSize) in HandleTransmit()
1049 numToCopy = context->txBufSize; in HandleTransmit()
1053 context->txBufIdx += numToCopy; in HandleTransmit()
1054 context->txBufSize -= numToCopy; in HandleTransmit()
1057 if (NULL != context->txBuf) in HandleTransmit()
1059 uint8_t *buf = (uint8_t *) context->txBuf; in HandleTransmit()
1061 Cy_SCB_WriteArrayNoCheck(base, context->txBuf, numToCopy); in HandleTransmit()
1069 context->txBuf = (void *) buf; in HandleTransmit()
1076 if (0UL == context->txBufSize) in HandleTransmit()
1079 context->status |= CY_SCB_SPI_TRANSFER_IN_FIFO; in HandleTransmit()
1084 if (NULL != context->cbEvents) in HandleTransmit()
1086 context->cbEvents(CY_SCB_SPI_TRANSFER_IN_FIFO_EVENT); in HandleTransmit()