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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 g) r0 p& o! J7 V" W
  1. [code]EDMA sample test application2 B  u  x1 ^) O8 m) \& e
  2. /*
      {  z4 A) p8 b+ [8 Y: f" i4 U5 D
  3. * edma_test.c& Y$ K8 F! m( ^5 e2 Z3 N; H% a
  4. *
    : |# t- d/ _. O; d
  5. * brief  EDMA3 Test Application2 n) y) O4 ?1 [6 X6 H  U0 B
  6. *
    ' ~$ Y/ J  u3 T) P. F
  7. *   This file contains EDMA3 Test code." L! w" F" S4 d
  8. *
    ; H% U; R1 X: y0 \9 L# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 x1 p- ~6 q( ]/ W' `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 z( |# h/ F  y4 n$ [  h- {
  11. *         TO CHANGE.
    / l6 Z( w$ Q6 i( P% X8 o
  12. *4 v! M/ V0 b% \- @% l: e: s) S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# r4 o9 J7 P& F
  14. *% f7 Y. n; [  X% l# D: F% g
  15. * This program is free software; you can redistribute it and/or! @9 w3 E0 _4 Q* Q3 A; `* ?6 M+ r
  16. * modify it under the terms of the GNU General Public License as) Y, ?7 y" X5 n4 Q: M. p' E
  17. * published by the Free Software Foundation version 2.; q: ^2 q/ a! k
  18. *
    4 H9 O. S) D. }6 Q& G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 d( T3 P4 R- l' t5 D
  20. * kind, whether express or implied; without even the implied warranty7 @; B+ X0 k8 @: g# k* s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 ?1 K! c$ F. P0 s; R
  22. * GNU General Public License for more details.% b, a0 A0 g, Q
  23. */
    : }& A/ X: [5 t$ q# S
  24. % \( m9 \, v4 j7 c
  25. #include <linux/module.h>; u- F1 Y4 |1 a1 x
  26. #include <linux/init.h>
    : n0 u% {) R3 a7 Z* a
  27. #include <linux/errno.h>* Y  ^+ h! l- M8 O$ J4 E0 b) e2 |
  28. #include <linux/types.h>
    / M4 a0 d/ F* x! O5 o
  29. #include <linux/interrupt.h>
    * ^7 }3 J2 G  _6 m7 t& v  r6 i& [( {
  30. #include <asm/io.h>
    8 q5 o: ?. l: [1 _
  31. #include <linux/moduleparam.h>
    ' B+ q( v; G% ~. _
  32. #include <linux/sysctl.h>6 c( Z2 F1 N8 K* z" j" U
  33. #include <linux/mm.h>
    . f1 g! D+ F1 g3 Y, m! e" K& @
  34. #include <linux/dma-mapping.h>  g/ N+ N2 Y' P$ [1 n. y
  35. . c! N+ `% l+ D( l+ t
  36. #include <mach/memory.h>
    0 j1 I7 ], \: r# e
  37. #include <mach/hardware.h>* N2 Z6 u0 c! b$ G5 Q
  38. #include <mach/irqs.h>
    & D8 H* P: ^; y: Q# L, K  L8 _
  39. #include <asm/hardware/edma.h>
    % y1 H$ O+ f% b. x0 r! l
  40. % l# U" v% U& a- X7 C- n
  41. #undef EDMA3_DEBUG
    3 Q' B) |1 z. n% _  v% {
  42. /*#define EDMA3_DEBUG*/
    4 n3 |, r" l6 a6 e  E" U

  43.   T' ~  A4 C8 E4 }( M; a8 ]! g
  44. #ifdef EDMA3_DEBUG
    3 ~/ r$ s; o% E" H  U0 F, z& y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * t/ E: |0 y; m% a. O$ D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! V! _# K* N2 R; a% K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / C; p3 x# _$ P8 `8 T
  48. #else
    / `  }* c$ q: U- N
  49. #define DMA_PRINTK( x... )) }1 R2 \$ K: ]) r" [
  50. #define DMA_FN_IN0 Q" l+ O( [$ j0 I
  51. #define DMA_FN_OUT' P" U0 B: p. T9 U  T: X
  52. #endif
      Z& K6 A; ^) e. j; Y
  53. : Y& b8 L& b3 ]* E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 A5 K/ p, r- H8 d4 P$ E0 ]
  55. #define STATIC_SHIFT                3
    5 P2 B7 A  ^2 H; R9 ~( [
  56. #define TCINTEN_SHIFT               20
    1 }# E( W! e; }' I# T8 Q
  57. #define ITCINTEN_SHIFT              21
    2 I% s, t- }: I2 S
  58. #define TCCHEN_SHIFT                22
    6 ?! j+ B9 e0 D# W/ w
  59. #define ITCCHEN_SHIFT               23
    : ^$ e, v" w. g( w4 K

  60. , C: _9 a$ h- t' Q
  61. static volatile int irqraised1 = 0;
    2 C2 K$ N) v. u. u. W
  62. static volatile int irqraised2 = 0;, n. ~- Q4 w/ F+ G/ Q" n

  63. ( @0 `* k* x9 u* L$ ^: @5 z7 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 _, t7 w/ |8 t$ N. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - z& K* R# P' U% f* Z% C7 l$ R  [3 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 A$ Z- {$ w) l

  67. * ^+ ?2 {8 `0 b1 w; y
  68. dma_addr_t dmaphyssrc1 = 0;$ @4 s5 s+ T4 H% V9 |8 b
  69. dma_addr_t dmaphyssrc2 = 0;
    4 _1 A; P/ T5 }$ w/ ~
  70. dma_addr_t dmaphysdest1 = 0;7 j7 K+ p1 J6 C. r8 G: i8 F
  71. dma_addr_t dmaphysdest2 = 0;# [5 y& U( @/ Y5 `4 [5 p+ e
  72. / F3 D5 {* ?0 O, k9 k0 f# L1 e
  73. char *dmabufsrc1 = NULL;
    1 `$ z% h: l, S+ k% T) b
  74. char *dmabufsrc2 = NULL;
    * _6 d6 m7 v* F
  75. char *dmabufdest1 = NULL;
    ( I9 A$ {) a" {8 E, f5 ]: J5 i
  76. char *dmabufdest2 = NULL;, ]. b) h1 M3 L" `5 a

  77. 0 n! v/ A! `! ^# [8 y- W
  78. static int acnt = 512;) M$ _( X/ N' s
  79. static int bcnt = 8;
    0 x/ Y& U  r9 Z
  80. static int ccnt = 8;# K* O7 M. v) c" Y; F/ U8 f) o4 L

  81. & A( F  Z* J$ F$ W, N1 b
  82. module_param(acnt, int, S_IRUGO);
    & S4 S" r0 Q' C- [* s9 b
  83. module_param(bcnt, int, S_IRUGO);
    ( }) V- t4 w1 v4 [8 p6 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 o& U9 }2 ^& w4 a& E- k8 Y' c) P
+ D4 d  N# I+ s! {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ b: k7 o/ o- `7 N; s5 i& ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ?$ c4 G7 \( ~& l+ M- J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, \+ _' [: j/ Q4 G$ u: y  W* \( O

+ a/ s; c# B( d) z* b* A% r
8 @9 U$ H* N4 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 02:02 , Processed in 0.117126 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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