I am using CCS 3.3 and try to intiallizing the GPIO as out put but there is problem in GPIO_Handle .
the register like GPEN,GPDIR .... are already define in API?
kindly help me how to use GPIO as out put to generate the square wave?
regards
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am using CCS 3.3 and try to intiallizing the GPIO as out put but there is problem in GPIO_Handle .
the register like GPEN,GPDIR .... are already define in API?
kindly help me how to use GPIO as out put to generate the square wave?
regards
To use any of the CSL modules, you will use #include <csl.h> and #include <csl_xyz.h> where xyz is the CSL module you want to use, in this case #include <csl_gpio.h>. This will make all of the definitions available that are needed. You will put the path to the header files into the project for the compiler include search path, along with the path to the rts headers.
Is this the information you needed to find the definitions? if you are looking for more information, please include an example or more detail on the problem you have.
You will also want to view the CSL API Reference Guide as this discusses all the different modules in-depth (and has some brief examples of how to use the functions). For example, you might want something like this:
GPIO_Config MyConfig = {
0x00000031, /* gpgc */
GPIO_GPEN_RMK(0x000000F9), /* gpen */
0x00000070, /* gdir */
0x00000082, /* gpval */
0x00000000, /* gphm */
0x00000000, /* gplm */
0x00000030 /* gppol */
};
GPIO_config(hGpio,&MyConfig);
The purpose of the CSL is to allow you to write a program that uses logical operations rather than having to hard-code things like the addresses for peripheral memory-mapped registers. Within the CSL library and the CSL header files are already defined the constants you need. By choosing the correct library and by defining the "CHIP_6713" or similar constant at compile time, you get the functionality you need for supporting your operations.
I have not tested the code below, but it should be very close to a working example that can toggle a single GPIO. You will have to make changes to how you use it, but the example shows how to initialize and configure and use the CSL GPIO module.
#include <c6x.h>
#include <csl.h>
#include <csl_gpio.h>
GPIO_Config MyConfig = {
GPIO_GPGC_RMK( GPIO_GPGC_GP0M_GPIOMODE,
GPIO_GPGC_GPINT0M_PASSMODE,
GPIO_GPGC_GPINTPOL_LOGICTRUE,
GPIO_GPGC_LOGIC_ORMODE,
GPIO_GPGC_GPINTDV_VALUEMODE ),
GPIO_GPEN_GPXEN_OF( 0x01 ),
GPIO_GPDIR_GPXDIR_OF( 0x01 ),
0x00000000, /* gpval */
0x00000000, /* gphm */
0x00000000, /* gplm */
0x00000000 /* gppol */
};
GPIO_Handle hGpio;
void main()
{
int i=0;
CSL_init();
hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
GPIO_config(hGpio,&MyConfig);
while (1)
{
GPIO_pinWrite(hGpio,GPIO_PIN0,i);
i ^= 1;
}
}