ImageVerifierCode 换一换
格式:DOCX , 页数:12 ,大小:131.61KB ,
资源ID:12852122      下载积分:1 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-12852122.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(SPIdriverIMPLv01.docx)为本站会员(b****6)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

SPIdriverIMPLv01.docx

1、SPIdriverIMPLv01 SPI Driver ImplementationTianjin UniversityInfineon Automotive Electronic Joint LaboratoryState Key Laboratory of EnginesTianJin University, ChinaRevision historyVersionByModificationsV0.1, 10th Sep 2007Nenghui ZhouCreationV0.11 7th November 2008Change document name to Contents1 Int

2、roduction 41.1 Overview 41.2 Reference 42. Type definition 53 Global Variable 64 Function Definitions 74.1 OCSPI_InitSync 74.2 OCSPI_DeInitSync 84.3 OCSPI_ReadAsync 94.4 OCSPI_WriteAsync 114.5 OCSPI_SuspendAsync 134.6 OCSPI_Notification 144.7 OCSPI Interrupt Functions. 155 Resources Configuration 17

3、5.1 Periperal Config 175.2 Interrupt Config 176 Compile Environment 181 Introduction1.1 OverviewThis document describes the implementations of the SPI driver to be developed in the frame of the GEMS-K1 project. The SPI driver configures the microcontroller internal peripherals, so that transmission

4、and reception of data is possible using serial synchronous communication. The microcontroller acts as the master of the communication, and it is connected to several slave devices.Note: 1. This driver is specified for master mode only.2. A channel is a SW logical entity which is mapped to a hardware

5、 chip select signal.3. Errors (Transmit, Receive, phase and baud rate) are not handled by the driver.1.2 Reference1 SPI driver specification document2 TC1766_um_v1.1_2005_08.pdf document2. Type definitionTypeDescriptionRangeOCSPI_ErrorTypeRecommended type: 16 bit unsigned value. Numbers from 0 to 15

6、 are reserved for the HIS IO Library itself, numbers between 16 and 63 are defined in the HIS IO Driver document. Error codes from 64 to 127 are for driver specific error codes not defined in the HIS IO Driver document and numbers starting from 128 are reserved for future use.OCSPI_R_OK OCSPI_R_BUSY

7、OCSPI_R_INVALID_CHANNEL OCSPI_ChannelTypeType to specify a channel from a channel devices. Fix type: 16 bit unsigned value.0 , 7OCSPI_MemPtrTypeType to hold the address to a memory location.0x00000000 to 0xFFFFFFFFOCSPI_SizeTypeType to hold info about the size of an object.0x0000 to 0xFFFFOCSPI_Noti

8、fType16 bit unsigned value.OCSPI_N_READYOCSPI_N_SUSPENDED3 Global VariableThis chapter describes the global variable used by scheduler.VarialbesTypeDescriptionSPI_MODULE_STATUSOCSPI_NotifType SPI module status: busy or idleSPI_MODULE_READ_ADDRESSOCSPI_MemPtrTypeRead data starting from “address”SPI_M

9、ODULE_WRITE_ADDRESSOCSPI_MemPtrTypeWrite data starting from “address”SPI_MODULE_MODEOCSPI_NotifTypeSPI module: read or writeSPI_MODULE_SIZEOCSPI_NotifTypethe number of words to be received or transimit.SPI_MODULE_PLAYLOADOCSPI_SizeTypethe number of SPI received wordsSPI_MODULE_CHANNELOCSPI_ChannelTy

10、peSPI current channel4 Function Definitions4.1 OCSPI_InitSyncSyntaxOCSPI_ErrorType OCSPI_InitSync(void)ParametersnoneReturnOCSPI_R_OK: initialization was successful.NotificationDescriptionInitializes global and module configuration. In details the driver should: Enable module clock. For MRST: Select

11、 option A or B (if available), select alternate input mode and pull device. For SCLK, MTSR and used chip select: Select option A or B (if available), alternate output mode and driver strength. Set active channels invalid. Receive interrupt: disable SRN (SRE=0), clear interrupt request flag (CLRR=1)

12、and set priority. ReentrancyNoRemarks4.2 OCSPI_DeInitSyncSyntaxOCSPI_ErrorType OCSPI_DeInitSync(void)ParametersNoneReturnOCSPI_R_OK: de-initialization was successful.NotificationDescriptionResets all SPI registers. ReentrancyNoRemarks4.3 OCSPI_ReadAsyncSyntaxOCSPI_ErrorType OCSPI_ReadAsync(OCSPI_Cha

13、nnelType channel, OCSPI_MemPtrType address, OCSPI_SizeType size)Parameterschannel: the 16 bit channel identification numberaddress: the address where the received data is writtensize: specifies the number of words to be received.ReturnOCSPI_R_OK: Reading of message is successful.OCSPI_R_BUSY: SPI bu

14、s not idle.OCSPI_R_INVALID_CHANNEL: not configured channel has been called.NotificationOCSPI_N_READY, OCSPI_N_SUSPENDEDDescriptionThe function allows the reception of “size” words, which are to be stored starting from “address”.If the SPI bus is not idle, the function returns with OCSPI_R_BUSY.When

15、all words have been received the notification function is called with OCSPI_N_READY.To be able to handle the transfer asynchronously the SPI will switch on the required interrupts. They will be switched off when all words have been received or when the channel is suspended.ReentrancyNoRemarksThe SPI

16、 transmits dummy data to receive the wanted data.4.4 OCSPI_WriteAsyncSyntaxOCSPI_ErrorType OCSPI_WriteAsync(OCSPI_ChannelType channel, OCSPI_MemPtrType address, OCSPI_SizeType size)Parameterschannel: the 16 bit channel identification numberaddress: the address with the words to writesize: specifies

17、the number of words to be received.ReturnOCSPI_R_OK: Reading of message is successful.OCSPI_R_BUSY: SPI bus not idle.OCSPI_R_INVALID_CHANNEL: not configured channel has been called.NotificationOCSPI_N_READY, OCSPI_N_SUSPENDEDDescriptionThe function allows the transmission of “size” words, which are

18、stored starting from “address”.If the SPI bus is not idle, the function returns with OCSPI_R_BUSY.When all words have been transmitted the notification function is called with OCSPI_N_READY.To be able to handle the transfer asynchronously the SPI will switch on the required interrupts. They will be

19、switched off when all words have been received or when the channel is suspended.ReentrancyNoRemarks4.5 OCSPI_SuspendAsyncSyntaxOCSPI_ErrorType OCSPI_SuspendAsync(OCSPI_ChannelType channel)Parameterschannel: the 16 bit channel identification numberReturnOCSPI_R_OK: function executedOCSPI_R_INVALID_CH

20、ANNEL: not configured channel has been called.NotificationOCSPI_N_SUSPENDEDDescriptionSuspends any asynchronous transfer on the SPI bus.ReentrancyYesRemarks4.6 OCSPI_NotificationSyntaxvoid OCSPI_Notification (OCSPI_ChannelType channel, OCSPI_NotifType notifType, OCSPI_SizeType size)Parameterschannel

21、: the 16 bit channel identification numbernotifType: OCSPI_N_READY, OCSPI_N_SUSPENDEDsize : number of words that have been transmitted / receivedReturnNotificationDescriptionThis is the function prototype for the notification callback function. The implementation is TBD.ReentrancyYesRemarks4.7 OCSPI

22、 Interrupt Functions.4.7.1 Receive Interrupt4.7.2 Configure Channel4.7.3 CheckInit5 Resources ConfigurationThe resource used by SPI driver5.1 Periperal ConfigSourceDescriptionSSC0As SPI hardware interfaceSLSO7:0Slave selection outputs 5.2 Interrupt ConfigSourceSRNTOSPriorityNameDescriptionSSC0SSC0_RSRCCPU3SSC0_viRxDispose receive affairs6 Compile EnvironmentCompile Tool: Tasking for Tricore

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2