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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' R! W4 |. \  z+ H
  1. [code]EDMA sample test application8 M) N, T1 M: E+ k1 J8 j! Y- }0 M, Y+ |
  2. /*
    $ j7 @' U. E) v
  3. * edma_test.c: g" R$ }5 `3 e  u+ W! w
  4. *
    ! D! G3 \7 N/ r
  5. * brief  EDMA3 Test Application6 ?  w3 I. x3 Q. r  ]: {: Z6 l
  6. */ r: e" ^& p8 H  E8 ~- j$ Y5 V
  7. *   This file contains EDMA3 Test code.  t4 r" g+ ?! l  Y3 h" E0 n0 M
  8. *
    ( Z- Y1 M. @+ l  s  e1 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. |+ e0 \" `  U& Q3 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" m, Y( d- Q7 |. P, v9 |# b; z0 k* M2 d
  11. *         TO CHANGE.
    $ F, k5 N5 p0 a  W: V! {
  12. *
    5 Y$ c* A% h3 A% Z& h% p9 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 b- @# e+ E$ X/ Z+ d0 a
  14. *" u9 s% N. t( g! {& u
  15. * This program is free software; you can redistribute it and/or
    4 p' p' K+ i, ~6 S) o) i) t
  16. * modify it under the terms of the GNU General Public License as
    . _, V7 l- i$ m8 J4 w; S4 i1 _: o
  17. * published by the Free Software Foundation version 2.
    6 [2 i" c) b) {- R& E% a
  18. *
    4 Q4 B$ M, c1 J' R3 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 n1 G' u$ Y! m, s5 ~
  20. * kind, whether express or implied; without even the implied warranty) R, O; D/ M0 ?5 A: F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( M% Z' s) A; q* V0 C% ]0 M/ d; I% m
  22. * GNU General Public License for more details.
    2 @4 S) @& I0 t6 ^5 I  r  K" i
  23. */- X" F0 \% x2 B& I; C

  24. 8 ?: n3 ~9 V+ n
  25. #include <linux/module.h>
    + {& Y0 o7 {: K0 A8 `& Y7 c4 j
  26. #include <linux/init.h>
    & b6 D/ s* H+ J2 z+ a4 W; q
  27. #include <linux/errno.h>
    ' q7 j5 s3 A- U4 l
  28. #include <linux/types.h>
    7 O  @+ K: q& O3 N( f
  29. #include <linux/interrupt.h>; ]  F0 g- Y6 G" Z& P
  30. #include <asm/io.h>
    ; m2 \2 ]* G5 ^0 j' L
  31. #include <linux/moduleparam.h>; a. i' b6 L5 H6 C( L
  32. #include <linux/sysctl.h>. o+ w4 |, e% q! c3 [' M  B2 x& ~
  33. #include <linux/mm.h>5 R1 `. c, l& w5 J/ K& I# [
  34. #include <linux/dma-mapping.h>
    $ `8 n& G$ e* v  C. R
  35. 7 N' j4 }) V9 Q! B
  36. #include <mach/memory.h>
    # K  ?/ ^& A9 `  T: L
  37. #include <mach/hardware.h>
    $ p% t' l3 H( l( T; v5 H
  38. #include <mach/irqs.h>
    8 ^7 w. D3 `. _. {6 D8 s0 P) P
  39. #include <asm/hardware/edma.h>& W, M7 |2 |* N3 H1 J( Z3 r; o
  40. ( @4 n8 c0 j. S% N+ Z2 f, B
  41. #undef EDMA3_DEBUG2 F0 F8 w2 D/ h# [/ `/ M% z, C# Z, a4 _
  42. /*#define EDMA3_DEBUG*/  @/ L4 F7 P3 r3 J* {- K1 O: L

  43. / V9 j% _3 i" ]8 ]; }. W/ o* q
  44. #ifdef EDMA3_DEBUG
    8 Q/ u1 S" N5 n  H" H. V; M; i4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 \/ E8 d: T- `* {9 O6 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - x0 E1 O& V* x8 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , F/ k8 X/ B0 U3 X0 Y' x
  48. #else
    2 ?9 B! }. l6 _  d$ A
  49. #define DMA_PRINTK( x... )
    / f, p! v( ], ^! a" Q
  50. #define DMA_FN_IN4 a: j- ?0 B# Y) ?* C# q0 z/ n$ B5 p
  51. #define DMA_FN_OUT2 B3 g( v1 T3 [8 h# N
  52. #endif8 W- m- b. ]/ T% k' Y
  53. . p! V) _6 n; O- a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& O8 W9 o8 A% _; l
  55. #define STATIC_SHIFT                3' c$ e/ {; S6 V( X" D0 ]% H
  56. #define TCINTEN_SHIFT               203 b& @1 y/ V. t
  57. #define ITCINTEN_SHIFT              214 g9 L% g6 [, [
  58. #define TCCHEN_SHIFT                22
    ; F7 _! w& z( ^- l8 j" E+ E  O$ z% N
  59. #define ITCCHEN_SHIFT               23/ I0 X3 _6 G& o) Q3 r

  60. 8 N8 t( T* o* I$ |) |' `
  61. static volatile int irqraised1 = 0;0 a, @0 M" c3 m
  62. static volatile int irqraised2 = 0;4 r2 S( m& g9 V. y* ^$ `, b

  63. 1 P& ]; m, X9 _- b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C1 g) J" U6 [" w4 v& P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V* n  w1 {; F6 a! A2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f% v  y5 E( Y  y; A. ^: J, C
  67. % A7 s7 H6 q" F) U9 q3 T7 O7 H
  68. dma_addr_t dmaphyssrc1 = 0;1 ~  t0 l- E" [& X8 [$ P
  69. dma_addr_t dmaphyssrc2 = 0;
    * V* R, N, a5 A( A$ c
  70. dma_addr_t dmaphysdest1 = 0;
    8 O3 L& I% |! u+ ^
  71. dma_addr_t dmaphysdest2 = 0;
    2 V. `2 o  k: u- j  g) J
  72. 1 o8 U; Q- ~% C) M' a
  73. char *dmabufsrc1 = NULL;
    4 r5 ]1 f6 ^' h3 n4 o: o( m
  74. char *dmabufsrc2 = NULL;0 g$ T+ p2 k+ E( h7 |) ^  Z
  75. char *dmabufdest1 = NULL;
    5 E9 A8 h0 h9 o) G8 r  Z( m
  76. char *dmabufdest2 = NULL;
    5 E- _4 x4 Y! M. N" z8 _
  77. $ D9 w0 E( X4 [5 |9 b* i
  78. static int acnt = 512;
    - \6 G: A; o+ v3 x" Y7 w- Q
  79. static int bcnt = 8;
    ! n7 ?6 a! {" e9 F* n
  80. static int ccnt = 8;: W3 P/ y7 N) w1 V2 N6 x
  81. # b( f0 I  i% h1 ~& |( J( {
  82. module_param(acnt, int, S_IRUGO);& N4 N* ]0 f' T, |
  83. module_param(bcnt, int, S_IRUGO);
    & f8 z" [5 _6 V$ O' l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 t( o: n- L4 S+ H; c4 l& f' }( I4 k0 }% o3 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ A! C& k# c1 d! @$ t- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Q0 I. J4 t( I9 b( M. U2 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ h* `2 i9 }! w: ^  f+ R

8 j$ T3 v5 w0 M* _' }# c, ^5 x$ F: H
1 O; D; W" ~4 f% G8 \$ M9 H& D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-23 14:31 , Processed in 0.064267 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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