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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 _1 t! G7 B3 W# N
  1. [code]EDMA sample test application
    ( I# Q/ i* _4 E0 G' Z7 Z" h
  2. /*5 r& H0 [: G" J5 p5 Z: J
  3. * edma_test.c
    0 ~/ D, k# p! G" Z
  4. *8 I+ C7 X3 N5 k5 D4 X# t" [5 u
  5. * brief  EDMA3 Test Application4 p8 v+ b" n  `, c: a
  6. *
    / y+ E9 ^% ^6 H6 P0 ?5 P$ p* u
  7. *   This file contains EDMA3 Test code.8 H( T9 R" t+ V4 n+ E# J
  8. *# U6 i* W% t& {( r, ?( x% F# E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) U9 y' A( s! d! G# {8 s5 b5 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 k1 N/ k! H- l3 O6 G4 I% [4 j
  11. *         TO CHANGE.* t  \) X3 ]4 J& S. {1 B
  12. *8 \. C) x6 W9 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z* {7 `0 d& g" a5 F. r' y  t
  14. *
    : H& p) K2 z, P0 f( C2 T
  15. * This program is free software; you can redistribute it and/or) K8 x1 K2 \: G" `8 a
  16. * modify it under the terms of the GNU General Public License as
    0 {+ T8 N% `. y! d; h6 M4 y
  17. * published by the Free Software Foundation version 2.
    ) V/ r4 ]8 c; O; q, c
  18. *
    + P1 ~+ v: _& c) V5 O2 }! a% R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # N& |; M8 |% R
  20. * kind, whether express or implied; without even the implied warranty# x% \1 p4 c' B$ z, i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 |( y5 w2 l% Y6 L
  22. * GNU General Public License for more details.+ S( T7 Z9 _* f
  23. */& q# `. U% s1 O+ D/ E& [# p

  24. 1 w" X( x; {: }; u) i( K& ]6 K
  25. #include <linux/module.h>
    / r; T, P; j2 p: C3 d- H" \
  26. #include <linux/init.h>' b7 N$ N/ e" U
  27. #include <linux/errno.h>
      k" c0 B) ?- x2 I$ j/ S
  28. #include <linux/types.h>
    , l" _$ }; i! `* u
  29. #include <linux/interrupt.h>
    - L% u$ n0 n- M3 j) a0 A
  30. #include <asm/io.h>
      t9 p4 r4 {! o3 @% ?* o2 e" O
  31. #include <linux/moduleparam.h>
    8 o- m1 U  f. T% `2 o
  32. #include <linux/sysctl.h>5 p" t9 |; Z3 }; V& |
  33. #include <linux/mm.h>) |4 L6 `1 |8 D0 C( w) ~$ p
  34. #include <linux/dma-mapping.h>
    3 Q6 O; ^% I/ y7 Y. B

  35. 3 y6 W, V# b: j- ~3 y; M, U1 T
  36. #include <mach/memory.h>
    . J& |- D  B2 ^+ [% l! B
  37. #include <mach/hardware.h>. l+ S) {: ?, F+ p' R
  38. #include <mach/irqs.h>( C1 E7 M& W- a5 {+ m7 ~0 t6 J
  39. #include <asm/hardware/edma.h>7 G9 y0 ~  ^+ v+ L# m3 _
  40. 0 L8 ?9 \6 P/ y' r( G. m. C: J
  41. #undef EDMA3_DEBUG* `, r* O# k( {- d4 f/ l4 c
  42. /*#define EDMA3_DEBUG*/
    , f7 l5 \$ s; F/ M3 h+ b* G3 g* t

  43. 1 q6 i% o8 c: Q( m; A8 A% v. y) _3 Z
  44. #ifdef EDMA3_DEBUG6 G- g, y  k+ R& r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q: j) y. n5 |# I- P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 t5 Y0 U5 r: q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). L4 N  K: f9 B. e
  48. #else1 r! Y& H. T  a* V
  49. #define DMA_PRINTK( x... )+ U; _2 @. ?$ q: M* E! ~
  50. #define DMA_FN_IN+ d2 I3 Z5 x8 f+ l+ s
  51. #define DMA_FN_OUT$ Y; h0 b' y, u: u$ y6 |. t
  52. #endif
    8 G4 |) @" G4 {9 F: i

  53. ; [4 V" K; F" B: _+ h( z3 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): r4 R" w5 q  x3 O7 y) v
  55. #define STATIC_SHIFT                3
    0 h% _9 x  m4 x
  56. #define TCINTEN_SHIFT               20" r4 k, e' e$ M. ^  s, l
  57. #define ITCINTEN_SHIFT              212 w; C* j" l! v& L- u0 d) a* P
  58. #define TCCHEN_SHIFT                22
    3 v6 n; L  D& F2 c$ y9 ~
  59. #define ITCCHEN_SHIFT               23
    / i# [, {" g2 L

  60. ' Q4 q# ^, P3 j- \. ^/ O# n; a5 s
  61. static volatile int irqraised1 = 0;
    8 E% U$ e9 \1 N) f7 K2 n& q
  62. static volatile int irqraised2 = 0;6 L; p6 @, X7 B' g7 ?
  63. + R- q9 P& Z" M! c/ K1 a* C0 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q, S! x, d' I3 U. d# U/ X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c6 m3 l! @: O* ]0 \1 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' v2 E2 b% m- E3 I& m6 y2 R
  67. 0 b; ~# W- }$ F- P9 I( d& @3 d7 l
  68. dma_addr_t dmaphyssrc1 = 0;
    ' g) n! ?$ ]$ {" t
  69. dma_addr_t dmaphyssrc2 = 0;, O) Y/ r3 _/ x! S: L! }
  70. dma_addr_t dmaphysdest1 = 0;) a+ o8 c8 I4 g% H+ N  H( [
  71. dma_addr_t dmaphysdest2 = 0;
    , U! l) o" h0 g8 z% K8 H) c& N

  72. $ l, k0 x, u! z1 ~5 Y6 [6 z
  73. char *dmabufsrc1 = NULL;
    3 H  ~! B8 O1 d
  74. char *dmabufsrc2 = NULL;
    / Z$ p7 ]$ W( f
  75. char *dmabufdest1 = NULL;) ?' l2 O3 Z1 O, j1 K" v! |
  76. char *dmabufdest2 = NULL;/ q8 G) z1 r6 R5 H  v

  77. $ a2 `) o( p/ S, I( C
  78. static int acnt = 512;3 G* r! x- c) K$ }+ M& Q
  79. static int bcnt = 8;
    5 }. M  ^1 i! V% ?& T3 G
  80. static int ccnt = 8;
    . i: A0 ?/ N2 A6 t; D

  81. $ H/ {6 n- ?+ \' Y3 t2 F* h
  82. module_param(acnt, int, S_IRUGO);( I* Y3 P( h* Z( f0 M) A
  83. module_param(bcnt, int, S_IRUGO);/ o2 p* L1 B$ W& T9 s. O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 G7 Z- i* j2 r' q+ V! d+ c$ _0 z, }
% k7 X" p' |" i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]$ D$ p8 w) X4 i6 E7 C  D2 C* ~7 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( B3 x7 |# t) ~2 G3 n0 w1 d- I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 k6 Q4 |1 d% y' C- n# y0 t
. G4 w8 W: D2 C5 d  }
, s1 ?% j- Y, l3 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 16:08 , Processed in 0.038414 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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