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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ b$ f# {/ k# N& K* ]! r! {
  1. [code]EDMA sample test application
    % m, E$ m) j, C$ C. `: ]: e, S
  2. /*
    ) m$ }5 B! ^1 G& I
  3. * edma_test.c
    4 J) f. q5 R' \
  4. *: u. H; p1 h2 w. W% x
  5. * brief  EDMA3 Test Application
    " Z& f2 J1 f& w: ?5 H
  6. *
    : q) S; E' f8 G3 n& C7 U
  7. *   This file contains EDMA3 Test code.
    , d& Q! Y8 ?# S9 X
  8. *8 I/ G% ?# C/ }6 v+ }: j2 l" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% b4 L8 J" a; j) I9 X" Z+ S, z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , g2 }" ]+ Z9 [, M, L
  11. *         TO CHANGE.
    8 {: ^5 }  q. q  Z
  12. *# i; I1 h  D1 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 O/ r) K0 L; @- p
  14. *. U- j8 r! \: g6 E8 q& h
  15. * This program is free software; you can redistribute it and/or
    ' j# g% g& e; V5 C  C9 C( E
  16. * modify it under the terms of the GNU General Public License as
    ; y! C* [, o0 e! T
  17. * published by the Free Software Foundation version 2.
    $ _$ b. b- Y) j, V
  18. *1 L% @/ y, R5 r; X+ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ~. C& t! \7 d3 R7 @/ T
  20. * kind, whether express or implied; without even the implied warranty
    - d5 z2 G2 v( ?3 \) E/ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ d/ m& q: S& j7 m
  22. * GNU General Public License for more details.
    1 J7 ?- B. o/ I& `/ E, `3 w& b# w
  23. */; v: }7 T! T3 d& j- V5 k

  24. 6 q) E) \) I  }( T
  25. #include <linux/module.h>
    " M  y; m+ Z( l4 `3 w! ~
  26. #include <linux/init.h>  o% ?2 q  n8 W. l, K. Y+ X
  27. #include <linux/errno.h>
    : t! w+ X* V# o' k2 g
  28. #include <linux/types.h>
      w: v! S$ a, o
  29. #include <linux/interrupt.h>
    8 _7 O2 M$ M( }' l1 @2 r. I; E
  30. #include <asm/io.h>5 p  |, F: `4 P  d' }
  31. #include <linux/moduleparam.h>; O# a. h( h3 w8 z6 |" N
  32. #include <linux/sysctl.h>
    - h+ e- {" l! I- K) ~9 a$ G/ D) P
  33. #include <linux/mm.h>
    % {% @5 k: y' C# P* w# N
  34. #include <linux/dma-mapping.h>
    3 D8 ^4 n- D& Z
  35.   }- [! m" I# N; Y& n
  36. #include <mach/memory.h>
    : i  Q+ i; E; n/ M; [
  37. #include <mach/hardware.h>
    , i/ W% c9 D5 E7 m+ E* f3 @' X9 q
  38. #include <mach/irqs.h>7 m& F. s& ?! O  d
  39. #include <asm/hardware/edma.h>/ _4 B5 ]& S2 s7 U1 D/ K4 M
  40. 0 C8 V1 N: t0 A0 I: X3 y
  41. #undef EDMA3_DEBUG( y8 X' a/ R/ z4 E! X: Q% i
  42. /*#define EDMA3_DEBUG*/
    , d  x% x+ ?$ ?- g* j3 V7 U4 A+ M

  43. 4 n- h1 z- `) L$ k! u6 x
  44. #ifdef EDMA3_DEBUG
    6 B" s$ r9 n6 B; C* [8 U1 Y7 ^% v6 |6 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 |) I* r# Q) h5 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  e5 T$ b# q" D* _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 S% y3 b4 h& ?) ~
  48. #else
    * ?5 i# h0 _) U1 T
  49. #define DMA_PRINTK( x... )
    ) F% r7 K1 h# s2 V3 W
  50. #define DMA_FN_IN% k  h) q1 _7 I5 J0 y+ i: R# z7 i5 ?
  51. #define DMA_FN_OUT8 }& X6 ~% J6 Q
  52. #endif
    ; j7 x% f2 ~2 I. y
  53.   i" @8 T- T2 p6 R' T7 x( w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 K. x4 W8 {4 U3 O$ j
  55. #define STATIC_SHIFT                3* _9 [1 }; }& T& Z" u# U/ ~# S1 j
  56. #define TCINTEN_SHIFT               20' B, T0 B# E5 g
  57. #define ITCINTEN_SHIFT              21- ?" r; n" N1 x
  58. #define TCCHEN_SHIFT                22  T0 i$ L/ \- p2 @4 N% F- b0 k2 b
  59. #define ITCCHEN_SHIFT               23
    " [& n7 T- \  v. S* e! k; V

  60. / C# ^! X5 m& q0 I) E# V9 l6 T
  61. static volatile int irqraised1 = 0;
    . J0 z, n# o1 w9 `" a
  62. static volatile int irqraised2 = 0;# q2 |: D4 W5 F8 z0 v" W

  63. 1 D5 h6 H5 D! {  Y0 V$ |: d. s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l& P1 R2 @6 B, i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * H/ K) l5 P) J% Z- E" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ u9 j- l. G. D

  67. * z6 ]% r- Z! f- q/ V- g' D
  68. dma_addr_t dmaphyssrc1 = 0;! X9 y2 g4 B6 C
  69. dma_addr_t dmaphyssrc2 = 0;
    " ]7 `5 ~, t1 J: H0 t8 @
  70. dma_addr_t dmaphysdest1 = 0;  Z9 P) m% h* C4 ^4 l0 e1 z
  71. dma_addr_t dmaphysdest2 = 0;, N! e  w+ g. R) Q+ \& r/ E

  72. 9 G6 S5 s; m5 j. E9 X" w" u
  73. char *dmabufsrc1 = NULL;
    0 u+ J: n+ k, R! k5 ]
  74. char *dmabufsrc2 = NULL;) L/ \4 ~2 `& g; j" m$ y+ g% ~0 L. f
  75. char *dmabufdest1 = NULL;
    ; K; t: {9 o0 J7 u, l( v/ }* w- K
  76. char *dmabufdest2 = NULL;
    + [3 F6 S) U0 P% S. N
  77. * I8 [4 N  x7 B8 ]- X( Q
  78. static int acnt = 512;: S% C& k7 _: q8 O* ?
  79. static int bcnt = 8;6 O" w0 p2 U& M
  80. static int ccnt = 8;0 X. C: Z1 ]" t

  81. , b) {0 d& J9 k  ^  B0 }0 O" t
  82. module_param(acnt, int, S_IRUGO);; v9 j$ Z9 \0 V, Q3 J
  83. module_param(bcnt, int, S_IRUGO);# I3 N& q0 T0 X$ k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) m) m# d% f% l+ }; V1 J- }
$ V& k$ U! I3 ]! t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ z5 D0 \7 [/ A: c, W9 p% ]9 X8 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l0 M; n' ~2 G" g% ^- x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# M9 I# u0 @- k& l

7 V0 Q  P4 T) f/ w# K# x( ?4 d( g6 u1 `3 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 17:57 , Processed in 0.042038 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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