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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" r+ k$ ?0 d+ ]% Z! W
  1. [code]EDMA sample test application& M- Z! \5 |7 Q. u) q
  2. /*/ l9 C  Z. R! O3 A- P7 q
  3. * edma_test.c+ G+ E# I6 Z) e, K) c. }
  4. *% F/ U5 @1 X( F. J
  5. * brief  EDMA3 Test Application8 G0 H6 I1 K& U# F" Y9 ^3 t
  6. *
    9 j$ s9 \. z( d  Z/ u0 z
  7. *   This file contains EDMA3 Test code.
    ; E! f9 ~1 w  z! w5 D% e
  8. *# X$ }4 ^: X6 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 z4 l, `9 R2 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- Q9 l, u. O+ p' Q" t* F, j
  11. *         TO CHANGE.
    ( a, ~' y  z) b( J( r
  12. ** `: ~9 x$ f; ^& d2 D1 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& J+ @6 p8 J* L& D/ A" }: I
  14. *
    5 {9 l! k0 J/ ~5 K! m
  15. * This program is free software; you can redistribute it and/or9 L; s% v3 a" ^5 i3 o: y
  16. * modify it under the terms of the GNU General Public License as2 B/ M$ s+ L& J" K& ?! ?
  17. * published by the Free Software Foundation version 2.6 j' j, ^0 J& U: s, i$ n7 p+ T
  18. *- T: T4 R- R1 T" H' o* u, [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 b% T' Q3 z. q7 L: o
  20. * kind, whether express or implied; without even the implied warranty* i. i2 }8 X! @: }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! V. q1 U( a" U1 R+ k1 L, g8 J
  22. * GNU General Public License for more details.6 t: O+ ?# ~4 C* b( C
  23. */8 m8 j" b* G7 \7 c) K  x5 T5 k
  24. $ `! I8 \) M9 u% X8 |9 s
  25. #include <linux/module.h>
    $ d+ j+ ]# f" N# F# T) O
  26. #include <linux/init.h>
    - ~9 k4 u: W& L! A+ d7 m
  27. #include <linux/errno.h>% j0 D/ |* C% q4 X( t" I5 p3 A
  28. #include <linux/types.h>2 q. ~$ o$ Y% D8 q& m% n) y! {
  29. #include <linux/interrupt.h>
    - p5 ?+ x4 _: l; R( t( U
  30. #include <asm/io.h>
    - f- n7 o: E) [
  31. #include <linux/moduleparam.h>1 @4 S5 \, g$ Q/ j8 `* m1 |
  32. #include <linux/sysctl.h>
    , x  U  r1 h7 Q2 U9 w' [
  33. #include <linux/mm.h>
    5 o# q6 x# }1 C+ w. \4 k
  34. #include <linux/dma-mapping.h>
    ' d! t/ d$ r1 I5 E) Q8 J

  35. * ^1 i8 d: [( Z2 m4 }
  36. #include <mach/memory.h>, F! |6 ^# _  D8 D# @7 v
  37. #include <mach/hardware.h>0 F9 d8 P* o# B/ o# R
  38. #include <mach/irqs.h>
    & E, ~4 H- K- k: L  F
  39. #include <asm/hardware/edma.h>
    + t& ]7 U( b( Z6 G: S' l. M" v% X
  40. ; n  O1 \9 [5 b6 e/ K+ E; [
  41. #undef EDMA3_DEBUG
    8 q' D" a- v& m
  42. /*#define EDMA3_DEBUG*/0 J/ p& x9 Q0 a

  43. . H  k5 i# P5 N; X* v0 h& Q
  44. #ifdef EDMA3_DEBUG
    3 t! p7 K7 B* z. {2 L  }% n0 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 n7 b# @* P4 k( J5 t, l& D! I# `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). G* \4 N& G9 X4 @  r/ y. x/ c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r; n! p2 M# }& j7 y& c# F) S
  48. #else0 E; @! g# Z9 Y5 A/ D0 f9 f  h
  49. #define DMA_PRINTK( x... )
      l  R) X2 B5 z, ^9 \
  50. #define DMA_FN_IN) v  t- l2 H, h! z& W/ m
  51. #define DMA_FN_OUT4 l9 a" n' `! L% o
  52. #endif+ ?4 _4 ]4 g5 h! y, o

  53. 6 s0 Q  ]( y4 V4 Z5 c4 A* t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 J6 P9 Y6 s3 ^+ V, ~
  55. #define STATIC_SHIFT                3
    % y; c4 ~3 x+ W' |
  56. #define TCINTEN_SHIFT               20
    1 ~/ ]: F* Y' _. k
  57. #define ITCINTEN_SHIFT              21, {8 |- R- {$ }
  58. #define TCCHEN_SHIFT                22( o3 y- T2 C+ k
  59. #define ITCCHEN_SHIFT               23
    # U' H9 q! L* o. S6 X( `2 V: x. d
  60. 0 m6 C9 ^( d7 g6 P0 t0 x5 g3 u
  61. static volatile int irqraised1 = 0;9 z% k1 B1 ^9 V5 C$ w* V8 }  t4 ^
  62. static volatile int irqraised2 = 0;' |  L" w) z3 P5 c
  63. ! O  y3 x  o1 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Y2 r; m8 L* u7 r  `' J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Y' r9 j* m! Z" |+ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e4 A4 X1 C9 F: V) `) @' g

  67. 1 z) ?, y6 z% }( g) v
  68. dma_addr_t dmaphyssrc1 = 0;  g0 N1 y& z! q6 `
  69. dma_addr_t dmaphyssrc2 = 0;/ P- K! z4 J$ ?8 b* f
  70. dma_addr_t dmaphysdest1 = 0;! z( [; r5 u3 O) a2 P7 ]$ E
  71. dma_addr_t dmaphysdest2 = 0;. K* i5 j: c+ a. G

  72. 3 d; ]! z( j4 w# j0 {% i! B+ B
  73. char *dmabufsrc1 = NULL;
    - s: l8 Y5 M, o6 x" |
  74. char *dmabufsrc2 = NULL;
    - }8 }. W1 B5 V5 \+ I
  75. char *dmabufdest1 = NULL;& w5 z- K6 [4 K; J$ Y( N8 q4 b
  76. char *dmabufdest2 = NULL;
    $ t; m$ d/ W' y3 E, Z6 T* U
  77. 4 D2 w6 j" W& q3 O8 B
  78. static int acnt = 512;, N0 @  Z8 M/ T. V
  79. static int bcnt = 8;  Y. _8 Z8 e/ U9 q- a, N) l
  80. static int ccnt = 8;2 c) T+ Q8 P! B0 Y; K" d1 d

  81.   ?: c, W# z" P, c& t: b; Z& [, {
  82. module_param(acnt, int, S_IRUGO);
    ) n' k2 @, K) T" M+ [2 Z; p( v
  83. module_param(bcnt, int, S_IRUGO);- D+ p  ], G9 p! \( W* h' b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ]: L3 @! A- H
1 I) d6 R) `. r, H7 e, y' _/ _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 _! \  j. M% G( _/ P. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# }! L* r) J7 t$ ?6 N( _6 {4 b8 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 o% O% r! U' X8 N- f( E' t9 ^' w) w0 G2 _0 o: X
' x( b5 Q' n' \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 05:07 , Processed in 0.040086 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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