OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7442|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , v9 ^* N2 e/ Y3 |" `' H& N* w
  1. [code]EDMA sample test application( v) j: ~5 U9 n, H. v7 e( |
  2. /*  Y0 N+ g6 c9 k  i
  3. * edma_test.c* k' q; j+ F7 ^3 D
  4. *
    ' H) u. @6 p1 |9 }
  5. * brief  EDMA3 Test Application2 n; h4 G2 b4 ]9 _- }
  6. *
    . T$ C- J3 D1 x( W) J
  7. *   This file contains EDMA3 Test code." U! Z4 W7 \4 ^1 R
  8. *8 L6 T, g* Q1 C5 i8 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      _% w4 L8 x2 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* T. L8 e7 }2 X& ~7 _# j0 ~
  11. *         TO CHANGE.* q" x! I) E0 q0 |# \+ {/ s2 C- B9 p
  12. *  s: I9 L4 `: h2 X8 M0 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ m" W$ b4 J% A  X2 v
  14. *
    ) v0 }' |' k( Q; K' q' K8 Q: c
  15. * This program is free software; you can redistribute it and/or& ]0 A7 y) v; A- H" m3 O
  16. * modify it under the terms of the GNU General Public License as  G; J; B/ S; Q6 E* ]6 T
  17. * published by the Free Software Foundation version 2.; P5 z' Q2 d7 s2 T7 k* w
  18. *
    1 \8 z6 ]$ C3 H0 ?# b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 z, Y1 w6 Q. M
  20. * kind, whether express or implied; without even the implied warranty
    5 k0 {. x" ?  U% ], g  `4 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; G! W- ]4 l/ N; T/ e2 z" W" v
  22. * GNU General Public License for more details." u* L/ R. G2 c5 m5 i$ F( X
  23. */
    " G* T0 O, i+ g3 |2 b* e% w7 T; O- {
  24. * ^6 x5 s: j8 ^. e) e  S
  25. #include <linux/module.h>
    5 j1 A+ H! z8 `5 {% c: B$ @
  26. #include <linux/init.h>3 ~7 z8 m8 U2 }9 Z  u$ ~9 f, U
  27. #include <linux/errno.h>: f% m. z1 b- |
  28. #include <linux/types.h>2 s  `& e2 ?' Q7 {6 v
  29. #include <linux/interrupt.h>" ~8 W" N! F" y3 r4 m" c
  30. #include <asm/io.h>& f# M1 Y" I$ X1 k7 ]4 X$ A
  31. #include <linux/moduleparam.h>. n  h: K( \5 ]1 E& K* K, g
  32. #include <linux/sysctl.h>- w$ d3 D1 i( i5 q
  33. #include <linux/mm.h>& W9 \) ~) J5 Z$ F& }! q
  34. #include <linux/dma-mapping.h>
    + W- i0 B4 b1 E" Z* }( \: R# V
  35. 0 d0 e7 n# R/ ]0 c5 k6 f
  36. #include <mach/memory.h>! n( s2 o- b! @5 A: l* z
  37. #include <mach/hardware.h>- ?# E# e* b% N+ ?; G
  38. #include <mach/irqs.h>  P8 x% ^2 t7 D
  39. #include <asm/hardware/edma.h>4 ]6 l' X, L+ [) C! G0 \
  40. $ U+ z! N5 w4 Y
  41. #undef EDMA3_DEBUG/ a/ C7 u4 u1 h* W% ]0 l
  42. /*#define EDMA3_DEBUG*/
    # a4 L" R5 S  r% z6 M7 b

  43. ( Y. i# U4 v, `! V( X0 K2 v$ N6 {, k
  44. #ifdef EDMA3_DEBUG  a1 A+ M2 q# K2 C3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 P; ?6 }) u/ y/ z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! G- L$ S+ t1 L2 S0 A& @! O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); V& p( S2 \0 U' b
  48. #else
    , j! n3 V, b1 x0 M  g
  49. #define DMA_PRINTK( x... )
    . H  |; C. m1 ~3 F5 o% V
  50. #define DMA_FN_IN; h1 H. G. O+ J8 [7 c( e% P3 D0 l
  51. #define DMA_FN_OUT
    5 |% U. Q4 p/ y0 x% b; G
  52. #endif
    4 b( \) |% Y" W9 g0 M
  53. 7 V- B" M8 e8 D( _  g8 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # K5 o4 u# ]# H: ]( U& c- X( N1 Y. l
  55. #define STATIC_SHIFT                3
    # B) N; I7 L3 e
  56. #define TCINTEN_SHIFT               20
    ! ?3 |+ }9 G8 |+ d5 ]2 C- e; S
  57. #define ITCINTEN_SHIFT              21! L* Y/ ~9 a0 Y3 F" @( u; q
  58. #define TCCHEN_SHIFT                22
    . u( X3 d+ ~3 P3 d7 W
  59. #define ITCCHEN_SHIFT               23
    2 `, r$ S" e7 J& a! H
  60. 8 n! b2 u/ v! G9 _: t0 w4 A& b; d+ W
  61. static volatile int irqraised1 = 0;
    ' a" |; i! M7 p$ \$ o8 Q1 `
  62. static volatile int irqraised2 = 0;  d5 s  K- n( n* x+ F$ Q
  63. * r5 l% y* K# D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ _1 b, H* i) v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A' U8 H4 f( h1 z1 a+ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; G* T  W" m0 _6 K6 Z  @

  67. : k2 k7 k/ ^4 X+ _" B$ a1 f
  68. dma_addr_t dmaphyssrc1 = 0;$ \+ ~. k4 h! z3 L$ F' a9 g
  69. dma_addr_t dmaphyssrc2 = 0;' h/ `- B4 N" E6 ^7 A
  70. dma_addr_t dmaphysdest1 = 0;
    / X+ i7 L& X6 T& Y' a7 S8 K7 ^6 ~
  71. dma_addr_t dmaphysdest2 = 0;4 X' Z# W- V7 J3 O. a

  72. % f! V6 a( Y0 z) o: k! l6 ?+ G
  73. char *dmabufsrc1 = NULL;
    - h4 s! Q( a8 m  B3 M
  74. char *dmabufsrc2 = NULL;4 a& W3 W2 x* X5 w* n
  75. char *dmabufdest1 = NULL;% y! L7 ?5 d2 P4 Y% T
  76. char *dmabufdest2 = NULL;- M3 Z& H" [2 G6 i/ s* n+ s8 ]

  77. 3 b, l5 Y+ u. s. G+ W
  78. static int acnt = 512;1 N, Q" N( y. l
  79. static int bcnt = 8;
    7 o) q& U4 V  s3 A' ?& }  q) D
  80. static int ccnt = 8;6 `% d2 w: i3 h. T
  81. $ l/ {8 S5 o2 N3 c5 }- i* q+ E
  82. module_param(acnt, int, S_IRUGO);0 X5 T# u1 w* ?% }  Q4 X6 d
  83. module_param(bcnt, int, S_IRUGO);$ t8 E, ^1 I% G4 j& p& W& ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" M( B0 [. [% h) R! T& h; g: C& Z! E$ e0 \! g) H" ^' D+ v6 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ?- u* c0 s) j9 @4 `) P+ X7 Z+ e
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 R2 ~3 q0 M5 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" V% ?+ j+ w3 {3 C& H& C$ w3 n
& r7 I  t# x; Q. ?
; S3 P% U5 S4 N5 y9 s* t9 w' x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-7-6 00:32 , Processed in 0.042904 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表