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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 \/ J) m0 ]+ J3 z# e6 x! @5 ]
  1. [code]EDMA sample test application: A, I- T' l% @
  2. /*; p/ ^3 z1 E' y$ |8 l- P% w
  3. * edma_test.c
    - k! y' X( H! e) }* h
  4. *, i9 }! B5 C( }" |
  5. * brief  EDMA3 Test Application; `  X+ q* |6 l8 w2 F8 w& o
  6. *9 T& E) p4 j* o$ t. \; @
  7. *   This file contains EDMA3 Test code.; s+ M! ?+ z4 V% W& I) M" G8 s* {& s4 p% A
  8. *& _5 x3 L0 i% |! C. x, x- B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 g, T2 l6 R5 w; H; B% z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + X/ ]0 G1 a7 C" N% `, j
  11. *         TO CHANGE.
    : @5 T. I- j$ A0 w0 Z. Z
  12. *9 w) H7 U4 s4 a7 @8 z. @  `4 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - j0 o) u. y" |4 F+ Y  d
  14. *
    1 V& D; q3 m$ G5 a2 F
  15. * This program is free software; you can redistribute it and/or
    * y, L  p4 ~9 |7 X3 q" a
  16. * modify it under the terms of the GNU General Public License as
    ) [! X, ^/ g, @' x$ }6 x4 L
  17. * published by the Free Software Foundation version 2.
    9 l1 E6 x( i( l, s% R/ f/ K
  18. *
    ) {2 h( i8 t* X9 q6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. r; Z$ k+ z6 }, k. V$ u
  20. * kind, whether express or implied; without even the implied warranty( C2 b8 ~' {! D& C7 Q( j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & B1 A" \0 S1 ]! }& T) O
  22. * GNU General Public License for more details.7 q( G$ @7 S. j! v, \
  23. */
    6 V4 t6 X4 n. ]% Y- h8 `1 |
  24. 6 L4 R. Y. m3 p# N( _
  25. #include <linux/module.h>
    , m6 \0 q# [( Q; L
  26. #include <linux/init.h>
    $ w$ F7 l9 `) |* R
  27. #include <linux/errno.h>8 U" K6 y% e2 R
  28. #include <linux/types.h>& d) P( e! S7 ?2 A% m
  29. #include <linux/interrupt.h>
    + _9 a" \5 A+ N/ W3 B) r
  30. #include <asm/io.h>/ \) ^7 J1 E5 b3 l( W+ E( ]
  31. #include <linux/moduleparam.h>
    - i& A  Z5 M( w7 ^5 y
  32. #include <linux/sysctl.h>9 o# J6 d5 g1 j# ^" e
  33. #include <linux/mm.h>2 S1 X$ R& e/ A- ^+ A9 z3 Q
  34. #include <linux/dma-mapping.h>3 i* c' f8 v5 g6 U

  35. * y% I& v3 \. t
  36. #include <mach/memory.h>$ ]  r6 P$ _) I; D1 p' B
  37. #include <mach/hardware.h>
    & Y% W4 {8 z$ j
  38. #include <mach/irqs.h>
    - \, C: e/ J/ s2 }
  39. #include <asm/hardware/edma.h>2 }2 u' ~  m" @
  40. # M& T$ [8 {, n; R- b
  41. #undef EDMA3_DEBUG5 V8 }# Q) Y: W5 t% N) p
  42. /*#define EDMA3_DEBUG*/
    % M' b0 ]7 s, e2 R' E8 O
  43. $ b2 v0 K  v" k: L
  44. #ifdef EDMA3_DEBUG' ]' t4 C* Y0 J' |: }; h+ o4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 p4 `1 ~2 V5 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 m* m( s  s9 v, ?- i+ q& ]2 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + C/ n' s/ Y5 d, H9 n/ H1 H9 D
  48. #else
    - r& a) C+ W- P/ I; Q" u  A* g
  49. #define DMA_PRINTK( x... )# p6 W) S; J( k: n" f/ w
  50. #define DMA_FN_IN: x2 _" O; a. I0 j! O5 e- k
  51. #define DMA_FN_OUT. z3 }2 K( D$ g# `/ `3 D. @0 I
  52. #endif6 i" V2 g" {; @9 x# P" d
  53. 8 e3 _( C" L* D- W2 f& m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * _6 t* J$ G9 g% |# ^" O; W- ]+ F
  55. #define STATIC_SHIFT                3' R# E) A" x5 L+ [
  56. #define TCINTEN_SHIFT               20
    : n# }0 g0 P  H; _8 k6 j! Z  h; e
  57. #define ITCINTEN_SHIFT              21. C6 H( i* b: V# h
  58. #define TCCHEN_SHIFT                22  g1 }5 F' G6 ?, X
  59. #define ITCCHEN_SHIFT               23' M2 ?3 E+ H8 a( Q7 Y
  60. 5 a8 k/ `* S* O+ ]" w4 o- m
  61. static volatile int irqraised1 = 0;; F- W$ U# p, @: d* `
  62. static volatile int irqraised2 = 0;
    / V6 j' j% ^; N; o& O: b4 }
  63. + F. Q$ _  U$ G" c! Q, {6 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H) A! n; C0 d0 G- v- b, m, U. |! r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y# t; W2 J  G$ R4 \" L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z1 G5 M9 j+ Y% b& e+ @' }

  67. , }+ @  ~4 d( u/ ]) V. i7 D
  68. dma_addr_t dmaphyssrc1 = 0;
    + p2 e+ J4 _. D" N6 M
  69. dma_addr_t dmaphyssrc2 = 0;
    : q5 I/ J8 _' V- r8 U
  70. dma_addr_t dmaphysdest1 = 0;
    $ d6 j( C. r0 ]7 L7 R* l& U( l
  71. dma_addr_t dmaphysdest2 = 0;+ s2 _! v- l& `3 ?

  72. / y8 C  l, t8 Q& s. C( `
  73. char *dmabufsrc1 = NULL;
    7 m0 m. c! [. v1 b& E7 |1 p5 O4 B. E* P5 d8 u
  74. char *dmabufsrc2 = NULL;! b) K9 k* A, @1 S8 t* F" D, u( I
  75. char *dmabufdest1 = NULL;
    ' `; {7 |' R/ y$ e- u
  76. char *dmabufdest2 = NULL;
    0 `# S) c- K( s7 J9 P" u: I, f$ a

  77. ! _& t3 l# F9 X  j* \" `
  78. static int acnt = 512;3 t3 [' m0 N8 F3 ?- ?
  79. static int bcnt = 8;
    ; W8 O* n6 b( q( D3 Y
  80. static int ccnt = 8;) E* X% r; r. T
  81. * c) t. n- C$ o( r3 S+ H
  82. module_param(acnt, int, S_IRUGO);- E+ [3 N# {  v9 O
  83. module_param(bcnt, int, S_IRUGO);# d# J6 s7 s0 I9 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% ^& Q4 q7 S* {* f0 g8 Q
+ Z+ ^$ U" M& J+ ]  l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; y  ~# p' K2 [; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Z: n4 K( n% U$ F& Q3 Y! D/ q+ N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 Z  i% l0 w5 i9 ]% c1 D7 L( j+ X
" v' J' d6 Q" ]% i" s, D% M; Q% w( H2 @3 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 20:04 , Processed in 0.039540 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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