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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 f' X- U+ G, z7 y2 @- @6 w
  1. [code]EDMA sample test application  a% C& s' l* M& Z1 _* B
  2. /*8 g& @5 s% B! i( _. N
  3. * edma_test.c! P& ^' l6 I( ~4 ?0 q
  4. *
    , w6 K$ N/ j! b7 I$ G- g6 |
  5. * brief  EDMA3 Test Application
    1 W4 e8 ?$ ~, H( R
  6. *' u6 I% V$ i" N+ x
  7. *   This file contains EDMA3 Test code.: t: e0 H2 f8 d: J! q+ t
  8. *
    # s$ I. h7 Q- L& g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      M& b- p$ X9 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 M- b, }: z. ?- k4 P
  11. *         TO CHANGE.: O7 r9 ^4 ?5 A+ j8 ~* U2 r( Q
  12. *2 d  z3 P7 T0 `9 I2 j* M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' L3 H* ^" _' T% I4 j
  14. *
    . R7 V  _. g0 e. a+ @) A/ L
  15. * This program is free software; you can redistribute it and/or
    $ L! f5 n  d& A  c. R9 j
  16. * modify it under the terms of the GNU General Public License as+ J5 e; Y3 z8 p8 n  L. I
  17. * published by the Free Software Foundation version 2.
    0 w  W$ v! H" J! R7 Y2 B/ M
  18. *
    9 I% Q, r" h- [* c1 }, S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Y1 R+ L; U$ [( F# j
  20. * kind, whether express or implied; without even the implied warranty
    # J& g, V9 }2 h  ]4 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : o& z1 L% t$ }( T8 `# a
  22. * GNU General Public License for more details./ {* Z; p& G8 w7 ~: B
  23. */0 P9 p; O2 }2 H0 W% N" K& S+ F
  24. ! [6 O; W3 X8 B6 w
  25. #include <linux/module.h>
      C# d6 J) o7 T6 E
  26. #include <linux/init.h>$ D" r% @7 ]1 J
  27. #include <linux/errno.h>% J1 z& p) A3 j$ ^% Q, p  D6 c
  28. #include <linux/types.h>
    : J: ~" l6 N4 ~+ q- o
  29. #include <linux/interrupt.h>
    ; Z9 i0 g" ?! J9 e. \# p4 A
  30. #include <asm/io.h>
    7 T3 m/ q  o& I! b. x
  31. #include <linux/moduleparam.h>& l1 T- ?+ c  X, V6 ^" q1 {' _  J7 O
  32. #include <linux/sysctl.h>+ @' i( v. x* I$ |+ D0 m/ @. e: Q
  33. #include <linux/mm.h>
    6 j$ Y7 q2 v: q' w# ~
  34. #include <linux/dma-mapping.h>( S. G! ]/ o* K) `# G; `) g7 V

  35. $ x: n% o% W) ?7 l4 p! G/ O" ]
  36. #include <mach/memory.h>) D7 V9 w; P5 @2 n) {1 J
  37. #include <mach/hardware.h>+ U% a$ |' b: _, U' O% q
  38. #include <mach/irqs.h>4 O6 r$ D6 L% Z' ^6 |1 |2 r# R
  39. #include <asm/hardware/edma.h>
    . C7 N, E* K8 K, K& `, B( ~
  40. * }* N5 N$ A0 D
  41. #undef EDMA3_DEBUG  k  c0 U; Q' t- R
  42. /*#define EDMA3_DEBUG*/
    * D- ^5 ?3 X. H$ X

  43.   `/ _" K- T" ]9 q& T8 A/ u% ^$ i
  44. #ifdef EDMA3_DEBUG
    5 ?$ w0 P3 \# W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ^6 o  `- n* {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 _1 p$ `5 \0 v7 ]  `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) s( v- J& d; z
  48. #else$ ^" j& o' W7 R) v9 N7 s
  49. #define DMA_PRINTK( x... )" I9 ~$ a, u1 P' ]7 n; _
  50. #define DMA_FN_IN2 z4 w+ X9 A  s0 x: K
  51. #define DMA_FN_OUT3 d0 s! z, ~( B5 \& a& j6 Y; X
  52. #endif5 X/ Y/ n! {3 b, u
  53. * F6 r; E% K$ j+ k+ a! b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 N5 A! {4 e) ?% Q# Y0 ~
  55. #define STATIC_SHIFT                3; p  p: q; W+ G
  56. #define TCINTEN_SHIFT               20) M# P" [5 ~9 I0 i! U' K; ^
  57. #define ITCINTEN_SHIFT              21
    , s3 A, {( q5 |" G9 B# u  W
  58. #define TCCHEN_SHIFT                22
    . B  v- @; w, T0 A$ _
  59. #define ITCCHEN_SHIFT               23
    8 Y) \5 C0 w0 p) I& V* j
  60. 3 {% K9 |9 V0 c
  61. static volatile int irqraised1 = 0;6 r4 G1 I2 r5 {( M! @1 m, F
  62. static volatile int irqraised2 = 0;) Y" ^6 n& Y2 x' z

  63. 6 l! P8 c: g0 ~; B9 u, h* H  g$ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R5 y5 F6 M  n9 O7 P; Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 f0 e7 k/ l9 K# d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " s- C6 t4 \7 H! y1 n9 g! P0 q
  67. 5 Y3 o4 z* Z0 }; Q4 Y9 f; C0 M
  68. dma_addr_t dmaphyssrc1 = 0;
    1 ~/ k6 |- q/ y5 V) s
  69. dma_addr_t dmaphyssrc2 = 0;" v5 W# Q9 S1 v+ d- ^
  70. dma_addr_t dmaphysdest1 = 0;
    & c7 |+ I$ F; ]3 g5 J
  71. dma_addr_t dmaphysdest2 = 0;
    2 s, a  X! d5 i# K- W. b/ c

  72. / d6 V* t, v; s: `" g! s/ A
  73. char *dmabufsrc1 = NULL;) }0 Q, B! R& C
  74. char *dmabufsrc2 = NULL;
    $ ]5 w2 O8 v9 l9 d
  75. char *dmabufdest1 = NULL;
    ) ~  G- P" j  k. a$ m: d: I
  76. char *dmabufdest2 = NULL;
    ( w5 N; `6 S/ y$ q

  77. ! @5 Y; `4 G; `2 b
  78. static int acnt = 512;
    - u4 @0 ^( X4 ?/ Q* l5 S
  79. static int bcnt = 8;( Z0 {9 N. Z1 F$ t- J5 W
  80. static int ccnt = 8;
    : C$ a" @) i8 i9 Q( M3 U2 Y- Z4 x
  81. 0 M" Y; f+ G, J) K  A3 w7 h0 x) j/ C
  82. module_param(acnt, int, S_IRUGO);" ^( J6 Q( e% o) y3 D
  83. module_param(bcnt, int, S_IRUGO);8 F- w1 w7 [9 a/ A% Z2 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; A, s  Z. P% r0 |% y) x! F9 E% u' r9 M7 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Y( P, \7 M+ B( o5 ~5 M% O3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; _, \* \4 {( `$ h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; }$ O/ k! O- r6 i" |1 G
. t) B3 T/ L9 R! {$ c2 A

9 o: @: m, \+ C0 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 09:26 , Processed in 0.042748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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