PSoC Creator 214:Datapath API Generation Presentation

PSoC Creator 214:
Datapath API
Generation
CYPRESS SEMICONDUCTOR
Component Development Documentation
Various aspects of component development are
documented in the following locations
Software Documentation
• From within PSoC Creator select:
Help->Documentation->Component Author Guide
Chip Documentation
• Datasheets and Technical Reference Manuals
• Available on the web:
www.cypress.com/go/psoc3
www.cypress.com/go/psoc5
Cypress Blogs
• Latest posts: www.cypress.com/go/blogs
• PSoC Sensei: www.cypress.com/go/psocsensei
Online Training
• http://www.cypress.com/go/training
PSoC Creator 214: Datapath API Generation
2
Development Kit Setup for Examples
PSoC Development Kit (CY8CKIT-001) is used for all examples
Shown using the PSoC 3 processor module
All examples can also use the PSoC 5 processor module
Many of the examples could also be run on:
• PSoC 3 FirstTouch Starter Kit (CY8CKIT-003)
• PSoC 5 FirstTouch Starter Kit (CY8CKIT-014)
Development Kit wired as follows:
P0_2 – SW1
P0_3 – SW2
P0_4 – LED1
P0_5 – LED2
P0_6 – LED3
P0_7 – LED4
PSoC Creator 214: Datapath API Generation
3
Naming in cyfitter.h
All chip registers allocated to a component will be included in the
cyfitter.h file
The generated naming in cyfitter.h follows a naming convention
<Component Instance>_<Verilog Instance>__<Register>
• For Datapaths the Verilog Instance includes “_ux” where x is the index of the datapath in
the chain (ie. 0 for the LSB)
Working Register
Suffix
Status
__STATUS_REG
Status Aux Control
__STATUS_AUX_CTRL_REG
Control
__CONTROL_REG
Control Aux Control
__CONTROL_AUX_CTRL_REG
Mask
__MASK_REG
Period
__PERIOD_REG
Accumulator 0
__A0_REG
Accumulator 1
__A1_REG
Data 0
__D0_REG
Data 1
__D1_REG
FIFO 0
__F0_REG
FIFO1
__F1_REG
Datapath Aux Control
__DP_AUX_CTL_REG
PSoC Creator 214: Datapath API Generation
4
Register Access Guidelines
Each register used by the API should have a #define for
the pointer to this register
Use reg8, reg16, reg24 or reg32 depending on the size of the
register
Name the pointer with an _PTR suffix
In the case of a reg8 value, a define with the same name without
the _PTR suffix should be used to refer to the dereferenced value
PSoC Creator 214: Datapath API Generation
5
Referencing Registers
Single byte registers should be referenced directly
without the use of the CY_SET_REG8 and
CY_GET_REG8 macros
Multi-byte registers must be referenced using the
appropriate CY_SET_REGx and CY_GET_REGx
The arrangement of the register address space allows
for the access of multi-byte registers based on the
address of the LSB
Chained datapaths are automatically arranged in sequential
UDBs
Addresses for a particular register type for a range of UDBs
are addressed with sequential addresses
PSoC Creator 214: Datapath API Generation
6
Example Header File
PSoC Creator 214: Datapath API Generation
7
Walkthrough Example
Add an API to the MyPWM16 component developed in a previous
training
Add .c and .h API files
Add parameters to the symbol
• Period – The period value
• Limit – The low period
Set the Doc.APIPrefix property to MyPWM16
PSoC Creator 214: Datapath API Generation
8