PWM driver tested in RTEMS with RGB

Martin Galvan martin.galvan at tallertechnologies.com
Thu Apr 14 19:05:08 UTC 2016


On Thu, Apr 14, 2016 at 1:34 PM, punit vara <punitvara at gmail.com> wrote:
> Hi all !
>
> I had successfully merged the TI Starter Ware Code with RTEMS.

That's great. Could you show us the resulting directory structure
(perhaps with a diffstat), as well as the changes to Makefile.am?

> Then I tried
> to test it with sample application with RGB. As a result I was able to glow
> the LED with that code but unfortunately, LED was only glowing constantly.
> It did not blink (at all !!!) according to duty cycle and frequency.

Odd. Could you post your test program (or preferably a link to it)?
Perhaps we can look into some of the APIs and see what's wrong.

> Yesterday I written my own functions similarly as Worth Burruss suggested
> me. But they are not exactly same as he told. Those functions are
>
> 1. To initialize PWM
> 2. To Enable PWM
> 3. To Disable PWM
> 4. Pinmux for PWM module
>
> I have used some Ti Starter Ware clock config functions along with my own
> written functions and successfully able to test PWM driver on RGB LED. Video
> is uploaded on youtube and please find the link as below.

So if I understand correctly, you were able to make this work by
writing your own code to access the PWM instead of the StarterWare
API? I'd like to see that code as well so we can compare it to
StarterWare's.

> https://www.youtube.com/watch?v=KsdtgVj-ZxU
>
> Please let me know if is there any problems with video.

Looks good!

> Martin, you told there are problem with some functions it would be better if
> you can share so that I can troubleshoot which TI Starter Ware code should I
> edit. Any comments and suggestions from community members are most welcome.
> I will soon share the code after suggestions or comments.

I just ran a diff between our sources and the SW version we downloaded
back then, found here:

http://software-dl-1.ti.com/dsps/forms/self_cert_export.html?prod_no=AM335X_StarterWare_02_00_01_01_Setup.bin&ref_url=http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/starterware/latest/

(You need to register a free account to download it).

>From what I saw, most of the changes we did were removing unused code
and fixing mostly cosmetic issues. I'm attaching the diff file so you
can take a look at it. I think one of the most important differences
are the changes in utils/delay.c; Sysdelay was replaced by usleep.
Don't ask me why though, that was a long time ago and it wasn't me who
did it :)

I also saw that SW has a git repository, which seemingly has quite a
few differences from the version we were using. Those seem to be
mostly related to FatFS though.

If I were you, I'd give the old SW code + our patch a shot, then if it
works I'd try to replicate some of the changes on the SW git.

Unfortunately, Marcos and I won't be able to test your progress
because we don't have our BBBs available anymore. We can still review
your code though, and I think Ben has a BBB if you want additional
testing.

On a related note, it would be better if you posted your progress on a
single thread so it's easier to keep track of. No need to open a new
one for each milestone.
-------------- next part --------------
Only in starterware-ti: AM335X_SoftwareManifest.pdf
Only in starterware-ti: AM335X_StarterWare_02_00_01_01_Setup.bin
Only in starterware-ti: binary
Only in starterware-ti: bootloader
Only in starterware-ti: build
Only in starterware-ti: docs
diff -ruw starterware-ti/drivers/cppi41dma.c starterware-taller/drivers/cppi41dma.c
--- starterware-ti/drivers/cppi41dma.c	2013-07-11 18:22:51.000000000 -0300
+++ starterware-taller/drivers/cppi41dma.c	2015-09-01 16:36:10.840799357 -0300
@@ -52,7 +52,6 @@
 #include "cache.h"
 #endif
 #include "uartStdio.h"
-#include "consoleUtils.h"
 /*****************************************************************************
 **                 STATIC FUNCTIONs
 ******************************************************************************/
@@ -2023,10 +2022,10 @@
     pend2 = HWREG(USB_OTGBASE + CPDMA_PEND_2_REGISTER);
     pend3 = HWREG(USB_OTGBASE + CPDMA_PEND_3_REGISTER);
 
-    ConsoleUtilsPrintf("\t\t%s: %s = %x\n\n", __FUNCTION__, " pend0 ", pend0);
-    ConsoleUtilsPrintf("\t\t%s: %s = %x\n\n", __FUNCTION__, " pend1 ", pend1);
-    ConsoleUtilsPrintf("\t\t%s: %s = %x\n\n", __FUNCTION__, " pend2 ", pend2);
-    ConsoleUtilsPrintf("\t\t%s: %s = %x\n\n", __FUNCTION__, " pend3 ", pend3);
+    pend0 = pend0;
+    pend1 = pend1;
+    pend2 = pend2;
+    pend3 = pend3;
 
 }
 
Only in starterware-ti/drivers: cpsw.c
diff -ruw starterware-ti/drivers/dcan.c starterware-taller/drivers/dcan.c
--- starterware-ti/drivers/dcan.c	2013-07-11 18:22:51.000000000 -0300
+++ starterware-taller/drivers/dcan.c	2015-09-01 16:36:10.840799357 -0300
@@ -1394,6 +1394,35 @@
                                            (extId & DCAN_IFMSK_MXTD));
 }
 
+
+/**
+ * \brief   This API will get the data length code.
+ *
+ * \param   baseAdd             Base Address of the DCAN Module Registers.
+ * \param   dlc                 Data length code.
+ * \param   regNum              Interface register number used.
+ *
+ * 'dlc' can take the below values \n
+ *    dlc can range between 1-8 for 1-8 data bytes \n
+ *    dlc value lying between 9-15 will configure it for 8 data bytes \n 
+ * 
+ * 'regNum' can take the following values \n
+ *    DCAN_IF1_REG - IF register 1 is used \n
+ *    DCAN_IF2_REG - IF register 2 is used \n
+ *
+ * \return  None.
+ *
+ **/
+void DCANDataLengthCodeGet(unsigned int baseAdd, unsigned int* dlc, 
+                           unsigned int regNum)
+{
+    /* Wait in loop until busy bit is cleared */
+    while(DCANIFBusyStatusGet(baseAdd, regNum));
+
+    /* Set the DLC field with the user sent value */
+    *dlc = HWREG(baseAdd + DCAN_IFMCTL(regNum)) & DCAN_IFMCTL_DATALENGTHCODE;
+}
+
 /**
  * \brief   This API will configure IF3 register set so that it is 
  *          automatically updated with the received value in message RAM.
Only in starterware-ti/drivers: dmtimer.c
Only in starterware-ti/drivers: ecap.c
Only in starterware-ti/drivers: edma.c
Only in starterware-ti/drivers: ehrpwm.c
Only in starterware-ti/drivers: elm.c
Only in starterware-ti/drivers: gpmc.c
Only in starterware-ti/drivers: hsi2c.c
Only in starterware-ti/drivers: hs_mmcsd.c
Only in starterware-ti/drivers: mailbox.c
Only in starterware-ti/drivers: mcasp.c
Only in starterware-ti/drivers: mcspi.c
Only in starterware-ti/drivers: mdio.c
Only in starterware-ti/drivers: phy.c
Only in starterware-ti/drivers: raster.c
Only in starterware-ti/drivers: rtc.c
Only in starterware-ti/drivers: tsc_adc.c
diff -ruw starterware-ti/drivers/usb.c starterware-taller/drivers/usb.c
--- starterware-ti/drivers/usb.c	2013-07-11 18:22:51.000000000 -0300
+++ starterware-taller/drivers/usb.c	2015-09-01 16:36:10.840799357 -0300
@@ -2912,7 +2912,6 @@
 				
 	/* Disable DMAEN in TxCSR */
 	ulRegister = USB_O_TXCSRL1 + EP_OFFSET(ulEndpoint);
-    tx_csr = HWREGH(ulBase + ulRegister);
 
 	/* Flush FIFO of the endpoint */
 	tx_csr = HWREGH(ulBase + ulRegister);
Only in starterware-ti: examples
Only in starterware-ti: grlib
Only in starterware-ti: host_apps
diff -ruw starterware-ti/include/armv7a/am335x/beaglebone.h starterware-taller/include/armv7a/am335x/beaglebone.h
--- starterware-ti/include/armv7a/am335x/beaglebone.h	2013-07-11 18:22:50.000000000 -0300
+++ starterware-taller/include/armv7a/am335x/beaglebone.h	2015-09-01 16:36:10.628799366 -0300
@@ -40,7 +40,7 @@
 */
 
 
-#ifndef _BEALGEBONE_H_
+#ifndef _BEAGLEBONE_H_
 #define _BEAGLEBONE_H_
 
 #ifdef __cplusplus
@@ -116,6 +116,10 @@
 extern void I2CPinMuxSetup(unsigned int instance);
 extern void GpioPinMuxSetup(unsigned int offsetAddr,
                             unsigned int padConfValue);
+extern void DCANModuleClkConfig(void);
+extern unsigned int DCANPinMuxSetUp(unsigned int instanceNum);
+extern void DCANMsgRAMInit(unsigned int instanceNum);
+
 extern void IOPadContextSave(CTRLREGCONTEXT *contextPtr, unsigned int ioPadOff);
 extern void IOPadContextRestore(CTRLREGCONTEXT *contextPtr,
                                 unsigned int ioPadOff);
Only in starterware-ti/include/armv7a/am335x: clock.h
Only in starterware-ti/include/armv7a/am335x: device.h
Only in starterware-ti/include/armv7a/am335x: edma_event.h
Only in starterware-ti/include/armv7a/am335x: evmAM335x.h
Only in starterware-ti/include/armv7a/am335x: evmskAM335x.h
Only in starterware-ti/include/armv7a/am335x: pin_mux.h
Only in starterware-ti/include/armv7a: mmu.h
Only in starterware-ti/include: board.h
Only in starterware-ti/include: cmdline.h
Only in starterware-ti/include: consoleUtils.h
Only in starterware-ti/include: cpsw.h
diff -ruw starterware-ti/include/dcan.h starterware-taller/include/dcan.h
--- starterware-ti/include/dcan.h	2013-07-11 18:22:51.000000000 -0300
+++ starterware-taller/include/dcan.h	2015-09-01 16:36:10.628799366 -0300
@@ -641,6 +641,8 @@
                                   unsigned int regNum);
 extern void DCANTransmitRequestControl(unsigned int baseAdd, unsigned int txRqst,
                                 unsigned int regNum);
+extern void DCANDataLengthCodeGet(unsigned int baseAdd, unsigned int* dlc, 
+                           unsigned int regNum);
 #ifdef __cplusplus
 }
 #endif
Only in starterware-ti/include: dmtimer.h
Only in starterware-ti/include: ecap.h
Only in starterware-ti/include: edma.h
Only in starterware-ti/include: ehrpwm.h
Only in starterware-ti/include: elm.h
Only in starterware-ti/include: epwm.h
Only in starterware-ti/include: error.h
Only in starterware-ti/include: gpio.h
Only in starterware-ti/include: gpmc.h
Only in starterware-ti/include: hsi2c.h
Only in starterware-ti/include: hs_mmcsd.h
Only in starterware-ti/include/hw: hw_cm_cefuse.h
Only in starterware-ti/include/hw: hw_cm_device.h
Only in starterware-ti/include/hw: hw_cm_gfx.h
Only in starterware-ti/include/hw: hw_cm_mpu.h
Only in starterware-ti/include/hw: hw_cm_rtc.h
diff -ruw starterware-ti/include/hw/hw_control_AM335x.h starterware-taller/include/hw/hw_control_AM335x.h
--- starterware-ti/include/hw/hw_control_AM335x.h	2013-07-11 18:22:51.000000000 -0300
+++ starterware-taller/include/hw/hw_control_AM335x.h	2015-09-01 16:36:10.664799364 -0300
@@ -222,10 +222,10 @@
 #define CONTROL_CONF_SPI0_CS0   (0x95c)
 #define CONTROL_CONF_SPI0_CS1   (0x960)
 #define CONTROL_CONF_ECAP0_IN_PWM0_OUT   (0x964)
-#define CONTROL_CONF_UART_CTSN(n)   (0x968 + ((n) * 0x10))
-#define CONTROL_CONF_UART_RTSN(n)   (0x96c + ((n) * 0x10))
-#define CONTROL_CONF_UART_RXD(n)   (0x970 + ((n) * 0x10))
-#define CONTROL_CONF_UART_TXD(n)   (0x974 + ((n) * 0x10))
+#define CONTROL_CONF_UART_CTSN(n)   (0x978 + ((n) * 0x10))
+#define CONTROL_CONF_UART_RTSN(n)   (0x97c + ((n) * 0x10))
+#define CONTROL_CONF_UART_RXD(n)   (0x980 + ((n) * 0x10))
+#define CONTROL_CONF_UART_TXD(n)   (0x984 + ((n) * 0x10))
 #define CONTROL_CONF_I2C0_SDA   (0x988)
 #define CONTROL_CONF_I2C0_SCL   (0x98c)
 #define CONTROL_CONF_MCASP0_ACLKX   (0x990)
Only in starterware-ti/include/hw: hw_cpsw_ale.h
Only in starterware-ti/include/hw: hw_cpsw_cpdma.h
Only in starterware-ti/include/hw: hw_cpsw_cpts.h
Only in starterware-ti/include/hw: hw_cpsw_port.h
Only in starterware-ti/include/hw: hw_cpsw_sl.h
Only in starterware-ti/include/hw: hw_cpsw_ss.h
Only in starterware-ti/include/hw: hw_cpsw_wr.h
Only in starterware-ti/include/hw: hw_ddr2_mddr.h
Only in starterware-ti/include/hw: hw_dmtimer_1ms.h
Only in starterware-ti/include/hw: hw_dmtimer.h
Only in starterware-ti/include/hw: hw_ecap.h
Only in starterware-ti/include/hw: hw_edma3cc.h
Only in starterware-ti/include/hw: hw_edma3tc.h
Only in starterware-ti/include/hw: hw_ehrpwm.h
Only in starterware-ti/include/hw: hw_elm.h
Only in starterware-ti/include/hw: hw_emif4d.h
Only in starterware-ti/include/hw: hw_emifa2.h
Only in starterware-ti/include/hw: hw_gpmc.h
Only in starterware-ti/include/hw: hw_hsi2c.h
Only in starterware-ti/include/hw: hw_hs_mmcsd.h
Only in starterware-ti/include/hw: hw_lcdc.h
Only in starterware-ti/include/hw: hw_mailbox.h
Only in starterware-ti/include/hw: hw_mcasp.h
Only in starterware-ti/include/hw: hw_mcspi.h
Only in starterware-ti/include/hw: hw_mdio.h
Only in starterware-ti/include/hw: hw_prm_cefuse.h
Only in starterware-ti/include/hw: hw_prm_gfx.h
Only in starterware-ti/include/hw: hw_prm_mpu.h
Only in starterware-ti/include/hw: hw_prm_per.h
Only in starterware-ti/include/hw: hw_prm_wkup.h
Only in starterware-ti/include/hw: hw_pwmss.h
Only in starterware-ti/include/hw: hw_rtc.h
Only in starterware-ti/include/hw: hw_tps65217.h
Only in starterware-ti/include/hw: hw_tps65910.h
Only in starterware-ti/include/hw: hw_tsc_adc_ss.h
Only in starterware-ti/include: mailbox.h
Only in starterware-ti/include: mcasp.h
Only in starterware-ti/include: mcspi.h
Only in starterware-ti/include: mdio.h
Only in starterware-ti/include: perf.h
Only in starterware-ti/include: phy.h
Only in starterware-ti/include: pruss.h
Only in starterware-ti/include: raster.h
Only in starterware-ti/include: rtc.h
Only in starterware-ti/include: systick.h
Only in starterware-ti/include: tsc_adc.h
diff -ruw starterware-ti/include/usb.h starterware-taller/include/usb.h
--- starterware-ti/include/usb.h	2013-07-11 18:22:50.000000000 -0300
+++ starterware-taller/include/usb.h	2015-09-01 16:36:10.624799366 -0300
@@ -51,7 +51,7 @@
 extern "C"
 {
 #endif
-
+#include "hw_types.h"
 //*****************************************************************************
 //
 // The following are values that can be passed to USBIntEnableControl() and
Only in starterware-ti/include: vpif.h
Only in starterware-ti: mmcsdlib
Only in starterware-ti: nandlib
Only in starterware-ti/platform/beaglebone: board.c
Only in starterware-ti/platform/beaglebone: cpsw.c
Only in starterware-ti/platform/beaglebone: ctlregcontext.c
Only in starterware-taller/platform/beaglebone: dcan.c
Only in starterware-ti/platform/beaglebone: dmtimer.c
Only in starterware-ti/platform/beaglebone: edma.c
Only in starterware-ti/platform/beaglebone: eeprom.c
Only in starterware-ti/platform/beaglebone: hsi2c.c
Only in starterware-ti/platform/beaglebone: hs_mmcsd.c
Only in starterware-ti/platform/beaglebone: rtc.c
Only in starterware-ti/platform/beaglebone: sysdelay.c
Only in starterware-ti/platform/beaglebone: sysperf.c
Only in starterware-ti/platform/beaglebone: timertick.c
Only in starterware-ti/platform: evmAM335x
Only in starterware-ti/platform: evmskAM335x
Only in starterware-ti/system_config/armv7a/am335x: cgt
Only in starterware-ti/system_config/armv7a/am335x: clock.c
Only in starterware-ti/system_config/armv7a/am335x: device.c
Only in starterware-ti/system_config/armv7a/am335x: ewarm
Only in starterware-ti/system_config/armv7a/am335x: gcc
Only in starterware-ti/system_config/armv7a/am335x: startup.c
Only in starterware-ti/system_config/armv7a: cgt
Only in starterware-ti/system_config/armv7a: ewarm
Only in starterware-ti/system_config/armv7a: mmu.c
Only in starterware-ti/third_party/fatfs/port: fat_mmcsd.c
diff -ruw starterware-ti/third_party/fatfs/port/fat_usbmsc.c starterware-taller/third_party/fatfs/port/fat_usbmsc.c
--- starterware-ti/third_party/fatfs/port/fat_usbmsc.c	2013-07-11 18:22:49.000000000 -0300
+++ starterware-taller/third_party/fatfs/port/fat_usbmsc.c	2015-09-01 16:36:10.696799363 -0300
@@ -54,7 +54,9 @@
 DSTATUS disk_status (
     BYTE drv)                   /* Physical drive number (0) */
 {
-    if (drv) return STA_NOINIT;        /* Supports only single drive */
+    if (drv) {
+        return STA_NOINIT;        /* Supports only single drive */
+    }
     return USBStat;
 }
 
diff -ruw starterware-ti/third_party/fatfs/src/ff.c starterware-taller/third_party/fatfs/src/ff.c
--- starterware-ti/third_party/fatfs/src/ff.c	2013-07-11 18:22:49.000000000 -0300
+++ starterware-taller/third_party/fatfs/src/ff.c	2015-09-01 16:36:10.816799358 -0300
@@ -40,7 +40,6 @@
 #include <string.h>
 #include "ff.h"            /* FatFs declarations */
 #include "diskio.h"        /* Include file for user provided disk functions */
-
 /*--------------------------------------------------------------------------
 
    Module Private Functions
@@ -598,17 +597,23 @@
     DWORD sect        /* Sector# (lba) to check if it is a FAT boot record or not */
 )
 {
-    if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK)    /* Load boot record */
+    DRESULT result = disk_read(fs->drive, fs->win, sect, 1);
+
+    if (result != RES_OK)    /* Load boot record */ {
         return 2;
-    if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)                /* Check record signature (always offset 510) */
+    }
+
+    if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) {                /* Check record signature (always offset 510) */
         return 2;
+    }
 
-    if (!memcmp(&fs->win[BS_FilSysType], "FAT", 3))            /* Check FAT signature */    
+    if (!memcmp(&fs->win[BS_FilSysType], "FAT", 3)) {            /* Check FAT signature */
         return 0;
+    }
     	
-    if (!memcmp(&fs->win[BS_FilSysType32], "FAT32", 5) && !(fs->win[BPB_ExtFlags] & 0x80))    	  	
+    if (!memcmp(&fs->win[BS_FilSysType32], "FAT32", 5) && !(fs->win[BPB_ExtFlags] & 0x80)) {
         return 0;
-    	
+    }
 
     return 1;
 }
@@ -620,6 +625,9 @@
 /* Make sure that the file system is valid                               */
 /*-----------------------------------------------------------------------*/
 
+typedef BYTE DSTATUS;
+extern DSTATUS USBStat;
+
 static
 FRESULT auto_mount (        /* FR_OK(0): successful, !=0: any error occured */
     const char **path,        /* Pointer to pointer to the path name (drive number) */
@@ -633,7 +641,6 @@
     const char *p = *path;
     FATFS *fs;
 
-
     /* Get drive number from the path name */
     while (*p == ' ') p++;        /* Strip leading spaces */
     drv = p[0] - '0';            /* Is there a drive number? */
@@ -645,24 +652,29 @@
     *path = p;            /* Return pointer to the path name */
 
     /* Check if the drive number is valid or not */
-    if (drv >= _DRIVES) return FR_INVALID_DRIVE;    /* Is the drive number valid? */
-    if (!(fs = FatFs[drv])) return FR_NOT_ENABLED;    /* Is the file system object registered? */
+    if (drv >= _DRIVES){
+      return FR_INVALID_DRIVE;    /* Is the drive number valid? */
+    }
+    if (!(fs = FatFs[drv])){
+        return FR_NOT_ENABLED;    /* Is the file system object registered? */
+    }
     *rfs = fs;            /* Returen pointer to the corresponding file system object */
 
     /* Check if the logical drive has been mounted or not */
     if (fs->fs_type) {
         stat = disk_status(fs->drive);
+
         if (!(stat & STA_NOINIT)) {                /* If the physical drive is kept initialized */
 #if !_FS_READONLY
-            if (chk_wp && (stat & STA_PROTECT))    /* Check write protection if needed */
+            if (chk_wp && (stat & STA_PROTECT)) {   /* Check write protection if needed */
                 return FR_WRITE_PROTECTED;
+            }
 #endif
             return FR_OK;                        /* The file system object is valid */
         }
     }
 
     /* The logical drive has not been mounted, following code attempts to mount the logical drive */
-
     memset(fs, 0, sizeof(FATFS));        /* Clean-up the file system object */
     fs->drive = LD2PD(drv);                /* Bind the logical drive and a physical drive */
     stat = disk_initialize(fs->drive);    /* Initialize low level disk I/O layer */
@@ -678,6 +690,7 @@
 #endif
     /* Search FAT partition on the drive */
 	fmt = check_fs(fs, bootsect = 0);    /* Check sector 0 as an SFD format */
+
     if (fmt == 1) {                        /* Not a FAT boot record, it may be patitioned */
         /* Check a partition listed in top of the partition table */
         tbl = &fs->win[MBR_Table + LD2PT(drv) * 16];    /* Partition table */
@@ -686,8 +699,9 @@
 			fmt = check_fs(fs, bootsect);            /* Check the partition */			
         }
     }	
-    if (fmt ||( LD_WORD(&fs->win[BPB_BytsPerSec]) != S_SIZ))    /* No valid FAT patition is found */    			
+    if (fmt ||( LD_WORD(&fs->win[BPB_BytsPerSec]) != S_SIZ)) {    /* No valid FAT patition is found */
 		return FR_NO_FILESYSTEM;    	
+    }
 	
     /* Initialize the file system object */
     fatsize = LD_WORD(&fs->win[BPB_FATSz16]);            /* Number of sectors per FAT */
@@ -748,10 +762,13 @@
     WORD id                /* id member of the target object to be checked */
 )
 {
-    if (!fs || fs->id != id)
+    if (!fs || fs->id != id) {
         return FR_INVALID_OBJECT;
-    if (disk_status(fs->drive) & STA_NOINIT)
+    }
+
+    if (disk_status(fs->drive) & STA_NOINIT) {
         return FR_NOT_READY;
+    }
 
     return FR_OK;
 }
@@ -1214,9 +1231,8 @@
     char fn[8+3+1];
     FRESULT res;
     FATFS *fs;
-
-
     res = auto_mount(&path, &fs, 0);
+
     if (res != FR_OK) return res;
     dirobj->fs = fs;
 
@@ -1253,6 +1269,7 @@
     FRESULT result;
 
     result = validate(fs, dirobj->id);            /* Check validity of the object */
+
     if (result)
     {
         return result;
diff -ruw starterware-ti/third_party/fatfs/src/integer.h starterware-taller/third_party/fatfs/src/integer.h
--- starterware-ti/third_party/fatfs/src/integer.h	2013-07-11 18:22:49.000000000 -0300
+++ starterware-taller/third_party/fatfs/src/integer.h	2015-09-01 16:36:10.816799358 -0300
@@ -19,7 +19,9 @@
 typedef unsigned int	DWORD;
 
 /* Boolean type */
-typedef enum {FALSE = 0, TRUE} BOOL;
-
+// typedef enum {FALSE = 0, TRUE} BOOL;
+typedef int BOOL;
+#define TRUE    1
+#define FALSE   0
 #define _INTEGER
 #endif
Only in starterware-ti/third_party: lwip-1.4.0
Only in starterware-ti/third_party: neonMathLib
Only in starterware-ti/third_party: xmodem
Only in starterware-ti: tools
Only in starterware-ti: uninstall
Only in starterware-ti/usblib: device
Only in starterware-ti/usblib/host: usbhhid.c
Only in starterware-ti/usblib/host: usbhhidkeyboard.c
Only in starterware-ti/usblib/host: usbhhidmouse.c
diff -ruw starterware-ti/usblib/host/usbhostenum.c starterware-taller/usblib/host/usbhostenum.c
--- starterware-ti/usblib/host/usbhostenum.c	2013-07-11 18:23:18.000000000 -0300
+++ starterware-taller/usblib/host/usbhostenum.c	2015-12-18 10:14:02.004138986 -0300
@@ -2104,7 +2104,6 @@
     // Check the arguments.
     //
     ASSERT(ulIndex == 0);
-
     //
     // Make sure there is at least enough to read the configuration descriptor.
     //
@@ -2115,7 +2114,6 @@
     //
     ASSERT(g_eUSBMode != USB_MODE_DEVICE)
 
-    
     if(ulIndex == 0)
     {
         g_USBInstance[ulIndex].uiUSBInstance = ulIndex;
@@ -3404,7 +3402,6 @@
 {
     unsigned int ulStatus = 0;
     unsigned int ulIndex = 0;
-
 #if defined (am335x_15x15) || defined(am335x) || defined(c6a811x)
     unsigned int epStatus = 0;
 
@@ -3470,7 +3467,6 @@
 {
     unsigned int ulStatus = 0;
     unsigned int ulIndex = 1;
-
 #if defined (am335x_15x15) || defined(am335x) || defined(c6a811x)
     unsigned int epStatus = 0;
 
@@ -3735,7 +3731,6 @@
 void
 USBHCDMain(unsigned int ulIndex, unsigned int ulInstance)
 {
-    unsigned int ulIntState;
     tUSBHDeviceState eOldState;
 
     //
@@ -3749,16 +3744,17 @@
 #ifdef _TMS320C6X
         ulIntState = IntGlobalDisable();
 #else
-        ulIntState = IntDisable();
+        // ulIntState = IntDisable();
 #endif
-
     //
     // Fix up the state if any important interrupt events occurred.
     //
     if(g_sUSBHCD[ulIndex].ulUSBHIntEvents)
     {
+
         if(g_sUSBHCD[ulIndex].ulUSBHIntEvents & INT_EVENT_POWER_FAULT)
         {
+
             //
             // A power fault has occurred so notify the application.
             //
@@ -3826,7 +3822,7 @@
 #ifdef _TMS320C6X
         IntGlobalRestore(ulIntState);
 #else
-        IntEnable(ulIntState);
+        // IntEnable(ulIntState);
 #endif
 
     switch(g_sUSBHCD[ulIndex].eDeviceState[0])
@@ -3845,13 +3841,14 @@
         //
         case HCD_VBUS_ERROR:
         {
+
             //
             // Disable USB interrupts.
             //
 #ifdef _TMS320C6X
             /* No DSP API to disable USB0 event */
 #else
-            IntSystemDisable(g_USBInstance[ulIndex].uiInterruptNum);
+            // IntSystemDisable(g_USBInstance[ulIndex].uiInterruptNum);
 #endif
            
             //
@@ -3886,7 +3883,7 @@
 #ifdef _TMS320C6X
             /* No DSP API to disable USB0 event */
 #else
-            IntSystemEnable(g_USBInstance[ulIndex].uiInterruptNum);
+            // IntSystemEnable(g_USBInstance[ulIndex].uiInterruptNum);
 #endif
              break;
         }
@@ -3895,6 +3892,7 @@
         //
         case HCD_DEV_RESET:
         {
+
             //
             // Trigger a Reset.
             //
@@ -4669,9 +4667,8 @@
         // HWREG(usbInstance->otgBaseAddress + USB_1_RX_MODE_AUTO_REQ_REG_OFFSET)|= 0x00000000;
         USBHostAutoReqClear(g_USBInstance[ulIndex].uiBaseAddr,
                                                    endPoint);	
-
-    }    
 #endif
+    }    
  else 
  {
     
diff -ruw starterware-ti/usblib/include/usbhost.h starterware-taller/usblib/include/usbhost.h
--- starterware-ti/usblib/include/usbhost.h	2013-07-11 18:23:18.000000000 -0300
+++ starterware-taller/usblib/include/usbhost.h	2015-09-01 16:36:10.580799368 -0300
@@ -361,6 +361,7 @@
 extern void USB1HostIntHandler(void);
 extern void USBHCDTimeOutHook(unsigned int ulIndex, 
 	                                                        tUSBHTimeOut **USBHTimeOut);
+extern void USB1ClearInterrupts(void);
 
 //*****************************************************************************
 //
Only in starterware-ti/usblib: usbbuffer.c
Only in starterware-ti/usblib: usbkeyboardmap.c
Only in starterware-ti/usblib: usbringbuf.c
Only in starterware-ti/utils: board.c
Only in starterware-ti/utils: cmdline.c
Only in starterware-ti/utils: consoleUtils.c
diff -ruw starterware-ti/utils/delay.c starterware-taller/utils/delay.c
--- starterware-ti/utils/delay.c	2013-07-11 18:23:14.000000000 -0300
+++ starterware-taller/utils/delay.c	2015-12-18 10:14:02.036138985 -0300
@@ -41,8 +41,10 @@
 
 
 #include "delay.h"
+#include <rtems.h>
+#include <unistd.h>
 
-
+static rtems_interval timeout = 0;
 /****************************************************************************
 **                        FUNCTION DEFINITION
 ****************************************************************************/
@@ -60,7 +62,7 @@
 
 void DelayTimerSetup(void)
 {
-    SysDelayTimerSetup();
+    //SysDelayTimerSetup();
 }
 
 
@@ -79,7 +81,8 @@
 
 void delay(unsigned int milliSec)
 {
-    Sysdelay(milliSec);
+    //Sysdelay(milliSec);
+    usleep(milliSec*1000);
 }
 
 /**
@@ -92,7 +95,9 @@
 
 void StartTimer(unsigned int millisec)
 {
-    SysStartTimer(millisec);
+    // SysStartTimer(millisec);
+    const rtems_interval offset = millisec*(rtems_clock_get_ticks_per_second()/1000);
+    timeout = rtems_clock_get_ticks_since_boot() + offset;
 }
 
 /**
@@ -106,7 +111,7 @@
  */
 void StopTimer()
 {
-    SysStopTimer();
+    //SysStopTimer();
 }
 
 /**
@@ -121,6 +126,7 @@
  */
 unsigned int IsTimerElapsed(void)
 {
-    return (SysIsTimerElapsed());
+    // return (SysIsTimerElapsed());
+    return rtems_clock_get_ticks_since_boot() >= timeout;
 }
 
Only in starterware-ti/utils: misc.c
Only in starterware-ti/utils: perf.c
Only in starterware-ti/utils: systick.c


More information about the devel mailing list