OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ]" a  E1 x, D/ G
  1. [code]EDMA sample test application6 I4 |; ~& P# k) j+ n) Z' l" n
  2. /*
    ( ]2 g( ]. t/ f& E
  3. * edma_test.c
    ( }, E  E* y% b; j) H2 ?: b
  4. *8 e- V7 A6 i: A, j
  5. * brief  EDMA3 Test Application
    # @  `& P5 O3 o1 y) q
  6. *' J8 h1 Q- s  j7 f- j: ]
  7. *   This file contains EDMA3 Test code.
    . y- e( p$ l0 K- v- t3 a
  8. *
    2 W! Q5 F- |' }7 b1 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 j# P( @) W+ I/ D- |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! b3 i3 ?) l& c8 h
  11. *         TO CHANGE.
    7 W/ V5 ]: I2 \( z9 R, k( u3 P7 a
  12. *
    0 _0 j( P+ G- L, ?$ }, E1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 X8 `; S, K  m2 m+ v. \
  14. *" P1 v! v% Q- g3 V) u, ?
  15. * This program is free software; you can redistribute it and/or
      O; s. M7 o8 p2 |
  16. * modify it under the terms of the GNU General Public License as
    1 N( j* z* ?7 P- Y7 G+ a) `' ^- w
  17. * published by the Free Software Foundation version 2.
    - f1 D- h1 S. m6 e- ?' S& A! H, U0 {
  18. *
    ' e$ l% J) J2 P! U; H! g! J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 h1 O+ @/ O: M0 N/ N4 j
  20. * kind, whether express or implied; without even the implied warranty
    ) S0 ]  v# _/ i$ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 P% j- h" R8 [$ C
  22. * GNU General Public License for more details.
    + }6 [5 z6 a3 V3 }0 }1 k
  23. */
    ) C  C$ @2 b5 w

  24. " t( y7 Y. A7 s; g  g3 u: p% @- L
  25. #include <linux/module.h>
    4 N) g7 T& f3 }& C. @5 @% X5 |
  26. #include <linux/init.h>
      K6 r) |. C3 i9 ]8 n# _; x
  27. #include <linux/errno.h>. f/ u2 s# J2 j! \) V
  28. #include <linux/types.h>
      W' F' U/ ^: ?: ^$ m3 A$ _
  29. #include <linux/interrupt.h>0 L8 R" K9 q' x' q
  30. #include <asm/io.h>  c1 a$ n& m$ j3 i* \8 ?
  31. #include <linux/moduleparam.h>
    * J# _: [, V' A* U2 N
  32. #include <linux/sysctl.h># S4 g+ u* @0 _
  33. #include <linux/mm.h>* K1 ?) u' v. O, d7 b
  34. #include <linux/dma-mapping.h>( `* j4 N( o  ]
  35. # y9 ^  a; W( L3 t& G
  36. #include <mach/memory.h>! _/ @' T  z$ [  J  N' @4 D- A
  37. #include <mach/hardware.h>" B, t$ {2 C! B' Y" L6 _
  38. #include <mach/irqs.h>
    ' E" M5 @+ d1 B# ^
  39. #include <asm/hardware/edma.h># l/ z# J( u4 I. I$ w( U2 L( Q
  40. 9 o3 C, g* j0 R: U9 m+ S, H
  41. #undef EDMA3_DEBUG. O3 |$ Y# ]& P# D% \( E
  42. /*#define EDMA3_DEBUG*/; b; v7 I; M8 I! m6 s0 k

  43. * ^6 s- t6 {. j2 l  v4 p* A
  44. #ifdef EDMA3_DEBUG3 [8 H2 R# {# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  I; F; w0 h, K( a$ l- h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' E' f3 B5 L6 s7 J7 b# C, Y4 n2 f- w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 u+ m8 S7 u9 b% p2 @0 ?7 m% V1 |$ L
  48. #else
    . y5 y( ~6 d- r$ _/ D: l
  49. #define DMA_PRINTK( x... )
    7 ]% m2 w0 t* |: K( T. h
  50. #define DMA_FN_IN6 A5 v( [; m: r! p- Q" L4 A
  51. #define DMA_FN_OUT. q8 v. ]; w6 g
  52. #endif
    2 Z# _+ a- N  _& ^

  53. # x' Q* |" s: \  S+ X+ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 k  G* N- u: Z( X, X# f0 f
  55. #define STATIC_SHIFT                3
    $ |$ R$ A4 {4 I( U: h, M' y
  56. #define TCINTEN_SHIFT               208 ^/ C) c  t' g! \' ]( K
  57. #define ITCINTEN_SHIFT              215 M' ~! C# h+ ~6 U- f' o( D
  58. #define TCCHEN_SHIFT                227 j* O+ r$ \* e  L, x; H
  59. #define ITCCHEN_SHIFT               23- d' R& n% E$ s2 ]9 w0 `
  60. 4 {) o( h) x  ~8 r- k6 K7 N
  61. static volatile int irqraised1 = 0;6 i+ [- p" E1 X; `
  62. static volatile int irqraised2 = 0;
    & Z+ c; {, C% n4 O
  63. ; Y/ d/ y8 G3 r1 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u! Z/ D/ l0 n$ }( z; i4 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% u6 Z1 v$ ?9 q! M" j; j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `: Q1 d8 E: f3 b. v4 C+ ^7 i% I
  67. ; {' v. S6 E' _! a
  68. dma_addr_t dmaphyssrc1 = 0;" O! m8 [) J8 u4 |5 M
  69. dma_addr_t dmaphyssrc2 = 0;
    ' r0 h$ j0 M: e* Z/ F" J1 A
  70. dma_addr_t dmaphysdest1 = 0;' k4 P. L* q' V. s
  71. dma_addr_t dmaphysdest2 = 0;8 m1 O& C& n. I* Y, `, K. |5 G. f
  72. ' O3 N; c! {% p! G  C5 Z: ?
  73. char *dmabufsrc1 = NULL;
    % G4 |) b+ F/ I* N- X
  74. char *dmabufsrc2 = NULL;. ~4 [# k* F. n
  75. char *dmabufdest1 = NULL;, b9 p8 n% R& o8 _7 e5 ]
  76. char *dmabufdest2 = NULL;; M' q7 Y. i0 l. Z5 n, h
  77. " n6 P0 ?2 ?/ Z7 W+ x" Y
  78. static int acnt = 512;4 z7 ^; g* o: z; n5 _" g
  79. static int bcnt = 8;
    & e* h! j; X) K5 E- W% `
  80. static int ccnt = 8;
    3 h$ G  ]2 o8 Y! p9 Y& M/ F% m

  81. 8 \3 @  z4 D' k* i1 V& `. ^7 Y
  82. module_param(acnt, int, S_IRUGO);
    1 p/ X- v  g+ P  t
  83. module_param(bcnt, int, S_IRUGO);7 `7 y3 f# L5 |7 z# |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 L5 A$ ~7 c6 ^) l' h: [/ _

9 \- `5 y+ x' H3 E8 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `1 t1 v! X3 j# x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q& w* q7 {0 h: E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ d; y/ g0 \+ V, M* }, ?

  y; V# [: b, h; Q; R4 |$ H) L) Y, {- W; c: x9 P/ G# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-23 12:37 , Processed in 0.043626 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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