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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m  Q* }* |+ ~) Q
  1. [code]EDMA sample test application
    4 y: Y; M# q9 P/ E  x) c$ ^, ^5 _
  2. /*
    5 P5 H1 O! M; \' D
  3. * edma_test.c
    3 |* c7 ]4 @1 {) ]+ s, n0 k
  4. *; g1 i2 v1 Q" Y4 b0 m1 T
  5. * brief  EDMA3 Test Application; g" H2 y4 q2 v3 l. ]: l
  6. *9 j# f# n  M9 \" y1 B* h" q  Z
  7. *   This file contains EDMA3 Test code.
    7 z: }7 i) _6 L1 Z/ A/ v$ S4 M
  8. ** s2 }) M4 S7 e1 A8 Q/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 }7 w, J  L& g% `3 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / ^) m2 o  r- D6 V
  11. *         TO CHANGE.
      d! I! |& z7 I% g8 D; n
  12. *# [2 Q  f* q1 l; j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 H0 H# W0 D2 S
  14. *
    1 i3 S" k8 P' J& x
  15. * This program is free software; you can redistribute it and/or0 l! d0 g1 s0 @5 b
  16. * modify it under the terms of the GNU General Public License as  k& m. q$ s  L1 I- C
  17. * published by the Free Software Foundation version 2.- d0 F+ N# i3 H! m! r- a3 z
  18. *5 W; i! V3 ~, q% O  f+ _/ D) Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 m1 l% E% ?& q% C- N/ T9 B2 D
  20. * kind, whether express or implied; without even the implied warranty
    ; q+ L5 e5 x( P& _) ]! e7 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 \! P- Y! r4 n
  22. * GNU General Public License for more details.
    . `$ ^" @; y( O! S7 s( I. @: w2 O4 Q
  23. */* |2 S- d4 }- F# ]& c) Y

  24. $ P7 o- q6 K' P, v
  25. #include <linux/module.h>$ O% R. c/ D+ k. b3 w: W
  26. #include <linux/init.h>" A6 x# _1 o6 v
  27. #include <linux/errno.h>
    / B+ d3 B- `( d# }- A
  28. #include <linux/types.h>
    & q7 `1 j$ c! r5 `" M
  29. #include <linux/interrupt.h>5 Q- C% }; f: U% X
  30. #include <asm/io.h>% a! J: t, J7 l+ l/ O
  31. #include <linux/moduleparam.h>
    - S' I/ I6 |0 v* |/ U1 E
  32. #include <linux/sysctl.h>' I# m- e  e. D2 v6 s
  33. #include <linux/mm.h>
    # S4 U4 W6 W* z
  34. #include <linux/dma-mapping.h>* S% @0 p8 Y' K- `* M  I' u$ P& l

  35. " N0 Y: e- _1 ~( M
  36. #include <mach/memory.h>' i/ q/ n5 l$ l3 p- ~
  37. #include <mach/hardware.h>
    9 C, M" m7 v& C6 t% e
  38. #include <mach/irqs.h>
    ' B! B9 \' _/ @8 ]$ S, d
  39. #include <asm/hardware/edma.h>
    8 Q3 \2 H: e+ _6 V2 ?5 i$ q
  40. 9 r% c) M$ g: B# E' ?6 T4 |2 [- m
  41. #undef EDMA3_DEBUG" Q: z" a' o' E/ D4 z3 f
  42. /*#define EDMA3_DEBUG*/
    : s& M5 A, C7 _( v8 V6 z
  43. , {3 S# Z9 z; }% |* V
  44. #ifdef EDMA3_DEBUG+ k6 H8 p9 t' c( D! F' s: f8 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( [; @& r* A: s/ v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % P' @8 U5 c- X3 `$ a6 D5 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ x0 r0 t7 g3 p" r  ^4 p
  48. #else
    ( o7 Z1 R9 l! s2 T, Q) H
  49. #define DMA_PRINTK( x... )
    ! u) w$ {3 j/ q6 X
  50. #define DMA_FN_IN4 k9 s9 L) E* W) r6 B9 j' C
  51. #define DMA_FN_OUT
    2 A0 \/ ?+ l, {" ^4 J' j
  52. #endif: E& M. u7 b( t( T/ ]1 w; E7 |

  53. ; E* A$ ^! Y  ]% I  d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Q8 @" Y; \& V7 }+ N5 ^9 j
  55. #define STATIC_SHIFT                3
    % b; w. S0 Z( f4 y+ w( T
  56. #define TCINTEN_SHIFT               20. r2 k; G, L+ ^# B# w
  57. #define ITCINTEN_SHIFT              210 c2 T7 x9 z9 J0 T3 V9 `& t' G
  58. #define TCCHEN_SHIFT                223 G" C; w, m' }% i
  59. #define ITCCHEN_SHIFT               23
    / `/ U; e7 i5 O$ `) {8 D, V
  60. , E9 R0 d7 ]. @3 f% h
  61. static volatile int irqraised1 = 0;
    ; [" _# O' @- u9 r2 v7 K# h( U2 H
  62. static volatile int irqraised2 = 0;8 m6 d  B0 w% Y1 L  J- h6 f
  63. " |$ L8 U6 U0 S7 H( M2 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _: f6 _0 G8 w5 C( K; G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 T& J$ p7 N! D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d2 e5 q8 h- A& A
  67. 2 T, B- p' f2 v& u
  68. dma_addr_t dmaphyssrc1 = 0;
    " V  x% ?/ y" a% ^
  69. dma_addr_t dmaphyssrc2 = 0;
    # D( w) i1 ~6 Z9 b0 u
  70. dma_addr_t dmaphysdest1 = 0;
    ; S! l& M# w8 K
  71. dma_addr_t dmaphysdest2 = 0;7 ]* f+ ?+ K+ [, G+ J" f
  72. , V1 G6 ], Y! x/ i: Z! f
  73. char *dmabufsrc1 = NULL;2 j( Q0 J" z! G1 r) \; d
  74. char *dmabufsrc2 = NULL;
    : N# _7 B) v* D5 z, G! |
  75. char *dmabufdest1 = NULL;  [, N, B7 P: H/ l7 @
  76. char *dmabufdest2 = NULL;
    , F9 q% r4 x. A- }
  77. % M+ Y5 E8 O& r& Q4 v8 l2 {
  78. static int acnt = 512;4 m3 V0 P8 ]( P. P% D: j9 j& I
  79. static int bcnt = 8;
    ) @7 }0 y# C; Z# E2 e  Q
  80. static int ccnt = 8;
    8 @. e7 ~$ q' x3 R: S9 O4 N

  81. + |$ @% A# A% a! n
  82. module_param(acnt, int, S_IRUGO);
    0 Y. ?, G0 g- L
  83. module_param(bcnt, int, S_IRUGO);
    3 D( C3 K( U! K/ t: [' [7 d* V# Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 }# a( h) z( E9 y* b; H, Y6 k! [

  D& R% \3 k& f% @0 C0 l4 L2 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 \' l& G' V9 k. `* l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" t( F+ S# ^/ h0 Q1 u5 d" B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ q9 F* ^3 v; ]; C! F$ C
' M4 m; O  V9 t' [' W% l1 R% c

! ~! ^. s- ^/ U; s6 g0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 15:05 , Processed in 0.039914 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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