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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" d4 i5 u1 O9 Q0 F
  1. [code]EDMA sample test application7 J. ]) x- A$ _/ ^# f+ _3 G
  2. /*
    - g: B3 h6 E; e5 Z5 n, j8 E
  3. * edma_test.c& m( Z. d2 M8 R. \7 ^
  4. *. @, |  ~. h3 Y! C
  5. * brief  EDMA3 Test Application/ [8 h# Q( C" {) M
  6. *( @; t2 j- O- H3 v# u: I# B
  7. *   This file contains EDMA3 Test code.
    ' X3 }, f, X- o5 x" ~! q
  8. *, P! F- V2 Y5 E  [* C/ j- X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & T& K" b# ]. o8 h% |3 q5 }8 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , E1 q" Z; r- _; F& A0 W3 L
  11. *         TO CHANGE.& r5 y7 Y' y& y, j8 z% O6 Y
  12. *
    7 C' s0 z8 \+ E' y: E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: ~: a" W, X8 o9 A: ~1 d# z
  14. *
    4 w0 q' b- o/ a% |! N3 T) U
  15. * This program is free software; you can redistribute it and/or2 Y; M% N( z3 E, ?( `- `! t. F
  16. * modify it under the terms of the GNU General Public License as  `$ X) N" |) Q6 f9 M
  17. * published by the Free Software Foundation version 2./ A+ Q1 o. }) l
  18. *" ?. ~+ P. O* h8 p) b* e4 f2 c' P, Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 t5 Z) r: O9 E- T* @5 j
  20. * kind, whether express or implied; without even the implied warranty
    ' {; h5 h) [6 E% u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / s; v& C6 J8 c6 w- }, S
  22. * GNU General Public License for more details.
    $ z* a) v' d  l' D& J% c
  23. */+ `3 T3 Z- ^) Z" x( b4 Y" u
  24. : y6 R' Q+ N' ?
  25. #include <linux/module.h>
    1 F9 M6 L+ B4 y$ `" f: R, s! a
  26. #include <linux/init.h>
    0 ^3 o0 I2 H* W: `7 |. M
  27. #include <linux/errno.h>; }5 M  B$ b  o
  28. #include <linux/types.h>
    8 e5 o- N5 h) i) g* _& c
  29. #include <linux/interrupt.h>* J' R0 ?) @  A0 E4 J
  30. #include <asm/io.h>
    % t( f* m5 f- a/ B0 T! J
  31. #include <linux/moduleparam.h>% O$ X1 n& Q( y% i! W3 X
  32. #include <linux/sysctl.h>! N* j3 c1 |) E- S% U
  33. #include <linux/mm.h>
    % _7 q3 k: @, H( T! V, }
  34. #include <linux/dma-mapping.h>
    0 U; U" A) i+ c  X
  35. 5 V- I7 G) D: Y" }/ O  c8 D
  36. #include <mach/memory.h>
    6 w! C6 L( P+ E. c8 f0 M
  37. #include <mach/hardware.h>
    , H, r5 [( a  V% A1 m# l4 K4 [
  38. #include <mach/irqs.h>/ Q  v+ ?3 V0 D( D- i
  39. #include <asm/hardware/edma.h>! d4 r" `% O- \) L" M( N* R6 |; f
  40. 2 w4 Z3 K1 d; x  K; P
  41. #undef EDMA3_DEBUG
    . k; U: y/ X! {: [: d% J5 X1 I  |1 G
  42. /*#define EDMA3_DEBUG*/
    % f6 j7 C+ V* q4 J+ L; k2 b

  43. ! J4 J0 p+ |/ ~+ G$ L* w. b
  44. #ifdef EDMA3_DEBUG
    & j+ P+ C8 d+ G) T) W6 a/ x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 b, y- h- R# i! [: h! [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ?) m# V2 }' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 M8 L) H# X6 G: B' A/ T
  48. #else
    - F. k0 ]1 |$ g/ r4 d
  49. #define DMA_PRINTK( x... )/ [9 d0 O; b9 P
  50. #define DMA_FN_IN
    ( C: a. k* A5 r' m
  51. #define DMA_FN_OUT" ^3 l/ G# f0 n/ F6 e$ ]  ?
  52. #endif
    . L- h+ q2 i8 ]) w, H- g- B

  53. * y6 v, K6 U- r5 Z3 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) V. z1 k  S* L8 Y& j0 e
  55. #define STATIC_SHIFT                3
    , u6 C9 l2 I8 t, v- I
  56. #define TCINTEN_SHIFT               20
    ! x4 L2 |( w3 I, ?) {7 A! v
  57. #define ITCINTEN_SHIFT              21. F, f( V: ~% n5 A* ]; z9 }
  58. #define TCCHEN_SHIFT                22
    2 H' U4 A9 y% ]7 [
  59. #define ITCCHEN_SHIFT               23/ i8 I/ h& P  u) S8 F! g' ]
  60. % |2 `7 r# U' o' E0 K1 z" G8 A
  61. static volatile int irqraised1 = 0;
    1 F1 t! A1 z( B1 g6 E
  62. static volatile int irqraised2 = 0;1 h* _2 {+ f! N) `- n; Q& m" v
  63. & @. B, m& L8 q% o5 e5 T: |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 |8 S0 _% [7 }1 B: h  ]" ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + _( E" ~7 ^6 n- ]' C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J* H+ H+ r* u
  67. % p5 u- Q  l3 B: x: ^
  68. dma_addr_t dmaphyssrc1 = 0;
    . ?( i6 n* y4 ^# B! K: d- \% X
  69. dma_addr_t dmaphyssrc2 = 0;% l1 G( K$ M, @8 m7 n" [, a
  70. dma_addr_t dmaphysdest1 = 0;& M, t3 ?, E. d% ~
  71. dma_addr_t dmaphysdest2 = 0;% I& V6 C- v2 J% M: M! r! n, U

  72. & A5 k6 u1 }: @. {) L
  73. char *dmabufsrc1 = NULL;7 V# J3 A* I/ }5 T) i( c2 Z
  74. char *dmabufsrc2 = NULL;+ L3 e  G' s7 N8 E1 l# g$ @; r
  75. char *dmabufdest1 = NULL;" T% ^5 b3 D% x3 B
  76. char *dmabufdest2 = NULL;
    : z. X$ }  d# |3 x, O+ t& V
  77. , T4 [( S& t& l$ h. ]: I
  78. static int acnt = 512;
    ( E$ Q; m" _6 `1 o0 }
  79. static int bcnt = 8;
    4 m- o0 _1 F, m9 t* ~- N2 H& q
  80. static int ccnt = 8;
    ; O+ m' h7 h6 _: k- }, e3 F
  81. 7 a0 T; R' z& v3 m; I$ \& i1 I, \6 Q
  82. module_param(acnt, int, S_IRUGO);
    & ]9 m2 L. L5 Z' J4 U
  83. module_param(bcnt, int, S_IRUGO);" s: d3 d  D8 W9 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 E6 s0 _: G6 ~2 V( Y) f
" {5 ^- C, @! X) M/ n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( y* R: o8 k0 N9 n7 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# `0 R; f$ @3 _1 o- ^4 @9 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 k, S+ f+ m  O! q% m( A+ w9 K
2 d- Y" P2 H& ^
9 M7 l. d& \1 {, j" [8 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 07:09 , Processed in 0.040625 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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