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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   _1 r6 e  c& Q# }- l  k
  1. [code]EDMA sample test application/ s3 j' i6 o, B: v
  2. /*. w4 w& x- R, s4 E, ]! O. ]# ~* l  H
  3. * edma_test.c
    1 c6 n. {$ d# R, u9 B, i4 i
  4. *. e& @1 w3 T) R9 a; D3 j3 E9 V
  5. * brief  EDMA3 Test Application1 u4 W! U# ~" _
  6. *. r( p, L0 ]; i5 y' h; K" K  t
  7. *   This file contains EDMA3 Test code.
    ) p' m6 b- M7 p8 \5 |
  8. *
    % g. K+ ?8 z1 U; a( b1 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 U" ?' ?+ Z8 M, {. [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # f  m: s/ k7 E) O! x! w
  11. *         TO CHANGE.
    3 A/ y1 {" d, G1 F. A
  12. *& F. y, @! W2 |/ v; `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / U/ C) ?3 z% Y
  14. *4 P2 f- L2 z! u
  15. * This program is free software; you can redistribute it and/or
    2 u4 t& F( j$ A9 ^
  16. * modify it under the terms of the GNU General Public License as
    - f8 Z% r! v: O( D6 l: C* V! c) n
  17. * published by the Free Software Foundation version 2./ C8 @9 |8 I$ u. W4 g1 g
  18. *
    ( \( l" ^6 B! _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; E9 I% g7 W+ T0 k* x5 }, g
  20. * kind, whether express or implied; without even the implied warranty
    & s. d5 K7 `+ @/ k5 K/ H/ M; h- e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( f9 s3 n, l; s& i
  22. * GNU General Public License for more details.
    * W1 @0 r" G  |/ B( I7 t
  23. */
    6 d3 K9 f+ Q7 F. p

  24. 6 ^# v- H8 T7 x" h$ V/ Z& o
  25. #include <linux/module.h>' c  g  p: e" g  g8 P
  26. #include <linux/init.h>3 d# D. a0 q) x6 E
  27. #include <linux/errno.h>' Q8 o: I- C/ S, y! |
  28. #include <linux/types.h>
    2 \: x7 n/ t9 [' D, `
  29. #include <linux/interrupt.h>
    8 W' c7 R6 u5 D5 H( S
  30. #include <asm/io.h>; z) W8 O4 \* F+ L1 R
  31. #include <linux/moduleparam.h>
    5 f% P, C8 f! I  C9 ^+ }* L
  32. #include <linux/sysctl.h>
    " m% t: }- ~' T! W- N3 c
  33. #include <linux/mm.h>
    ! O$ s4 h  P6 F" I1 D- B4 ?; J, k
  34. #include <linux/dma-mapping.h>
    $ B  b; e+ [' K9 ^7 B

  35. 4 u$ k6 |  I9 J! _1 r
  36. #include <mach/memory.h>5 K7 I- s- f, l5 H$ U; w' Y
  37. #include <mach/hardware.h>
    + D2 V4 W6 N  ]9 u! h) d' \! Z
  38. #include <mach/irqs.h>
    : K( f) N, b. k; E$ u# h+ Z! }1 Z
  39. #include <asm/hardware/edma.h>
    ! F4 `1 }; F( L* K# c4 J, N
  40. 8 D" p. S, z1 Y6 E4 j% }' E
  41. #undef EDMA3_DEBUG
    5 D( N( k4 {2 X; t: C: e; q: @
  42. /*#define EDMA3_DEBUG*/" v' K2 a, t' P: k  \. W

  43. 0 V7 [. ]7 |6 w0 q7 Q4 L' O
  44. #ifdef EDMA3_DEBUG. }: p( Z- L4 i# Q* C% F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); n  @% K8 {/ w0 L" X' B, W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 m3 Z5 _* k2 w6 N1 w# ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 x: Z: @. t# q
  48. #else! w' |4 @  b3 @  H" |* @
  49. #define DMA_PRINTK( x... )' d5 P4 n8 \( ~8 K0 @
  50. #define DMA_FN_IN
    ' E6 e9 C  W+ u6 G# j$ @" e  p
  51. #define DMA_FN_OUT
    $ y& H. P! x) \9 `
  52. #endif9 r3 V/ m, [  ]3 i

  53. . V2 S+ \" s5 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 g" v3 ?, _  f  n
  55. #define STATIC_SHIFT                3' A/ M1 b- u* j" M/ n; m
  56. #define TCINTEN_SHIFT               205 Q) I  u: s' Z% }( T
  57. #define ITCINTEN_SHIFT              21
    $ ]1 m7 w; K# o( ^4 q' f
  58. #define TCCHEN_SHIFT                22) r# |! f7 L0 F% r, X0 [1 ]% ~
  59. #define ITCCHEN_SHIFT               23
    ( G  B9 _' Z! i, L0 T  F- t

  60. ( n9 R4 H4 x; I2 k. R
  61. static volatile int irqraised1 = 0;0 ~6 \2 ?1 ?# n7 F, e
  62. static volatile int irqraised2 = 0;0 E  c3 a* @$ m& |* n2 |
  63. * x! D+ Y5 O/ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W: d/ v# [( D/ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , R+ _6 z# {; T- M* t* u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ M: V1 |, [; H8 |

  67. / |5 c/ ]' S- A  ]6 q/ k
  68. dma_addr_t dmaphyssrc1 = 0;; P2 E8 n/ j5 F. R/ A
  69. dma_addr_t dmaphyssrc2 = 0;5 M& `7 T: p! C
  70. dma_addr_t dmaphysdest1 = 0;
    ' ^3 c7 M% w4 T8 a+ k& [7 w7 l8 K
  71. dma_addr_t dmaphysdest2 = 0;- G1 P! n2 U5 N" F4 O4 K; c

  72. $ G- V: H/ g8 m1 d6 P
  73. char *dmabufsrc1 = NULL;5 |# |3 @) C7 B' I
  74. char *dmabufsrc2 = NULL;
    / Y0 B8 h4 u* P1 x( K
  75. char *dmabufdest1 = NULL;
    , L4 N5 O& Y, X& d1 q  x
  76. char *dmabufdest2 = NULL;1 m8 [! g5 b8 n4 J4 k: F

  77. 6 }# \6 _/ h* B
  78. static int acnt = 512;* E7 F7 l! T* @
  79. static int bcnt = 8;$ H1 [( }- F; n( F3 l6 J. h# H
  80. static int ccnt = 8;, K3 w8 S% d7 x

  81. . s- S2 O/ b: Y9 a. C$ ^( \
  82. module_param(acnt, int, S_IRUGO);5 D6 }/ s  i5 k
  83. module_param(bcnt, int, S_IRUGO);
    4 B( I% E+ j, ]& M8 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  L3 ~0 y" _# q6 m! u+ @  A) j: K  i+ K) C; s( g) H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* f& ?( \5 }  C: l" v" U. G8 }/ ?2 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 D5 S& L, N3 L  g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R6 [/ }+ K& [+ i; }  x0 m& L. b* i6 C/ c; D) X4 y2 m% x

7 e: e- ~; s' {* I& D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 16:22 , Processed in 0.039210 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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