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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Y9 U" I* i2 w" i- j' t$ B/ i9 \
  1. [code]EDMA sample test application
    + |0 L  u' U& z+ P5 x- n) E
  2. /*% W9 \8 y6 ]6 M0 R# |( p2 b6 L+ k- R
  3. * edma_test.c
    0 K9 S$ L$ \! o* b: _5 d  M7 ^% y; n! o
  4. *' \& L& I( ?! [! \7 i
  5. * brief  EDMA3 Test Application4 ~) G4 a' |0 h0 C- |4 g
  6. *
    2 A, \, R+ N5 E% G0 s  Z8 r6 c: l
  7. *   This file contains EDMA3 Test code.! H& R- B- ]+ x: ?8 L3 w6 g7 X
  8. *" A4 t* D7 t5 x2 b4 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ }' b8 H8 n. A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R3 H" r8 }& i. C
  11. *         TO CHANGE.
    + \7 o+ H0 i6 X
  12. *
    ' z* N4 O* c1 b2 c$ Z5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q# ^6 a1 T; e
  14. *
    , k% p- q1 M* K% s1 x5 i6 k+ R
  15. * This program is free software; you can redistribute it and/or
    7 Y6 o$ [8 S3 |$ J# T
  16. * modify it under the terms of the GNU General Public License as
    - g* x+ Q1 |6 W6 {0 ^4 q
  17. * published by the Free Software Foundation version 2.! c4 e, Y* S4 ~5 E1 ]; k* k
  18. *' g, a/ H# f1 F4 j8 N  D+ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 y4 ^' n  p6 S9 X+ {, X  r! h: x
  20. * kind, whether express or implied; without even the implied warranty, m' O8 L  c2 d: u3 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % c+ X, ?/ _: Q+ }* w2 x; ~; d
  22. * GNU General Public License for more details.2 m3 J! v% N5 N. d9 k4 T
  23. */
    . w) W, Z) A7 t8 j  d! f

  24. & U7 C" p1 B/ d5 s. k1 I7 K; l
  25. #include <linux/module.h>
    4 `, R! b' d; I6 D
  26. #include <linux/init.h>
    5 ~+ W/ B- t7 a6 O
  27. #include <linux/errno.h>+ U% T( M2 {- N8 L
  28. #include <linux/types.h>) k& f5 [* a" E/ E: z
  29. #include <linux/interrupt.h>
    ) W+ d9 H# q3 P9 R! z% J
  30. #include <asm/io.h>
    , T2 P" M8 _* o3 E. j! {
  31. #include <linux/moduleparam.h>
    - N; _' j, C1 ~2 c
  32. #include <linux/sysctl.h>9 V% j  M% C# t) F9 ]9 s: k
  33. #include <linux/mm.h>) V# e+ ^7 \# t0 ^5 C
  34. #include <linux/dma-mapping.h>
    * q4 n6 E8 o  F9 W
  35. : E! y) ^; u0 [( [6 Q  ]" A4 ]
  36. #include <mach/memory.h>
    " |5 b3 N3 z7 m7 j& g
  37. #include <mach/hardware.h>+ g5 K0 q  @$ H+ W5 v5 G
  38. #include <mach/irqs.h>6 g3 f: M8 s' ]$ `( p  u
  39. #include <asm/hardware/edma.h>
    - J- _' w: C6 b- b4 K4 h% j

  40. : Z3 [. U$ e' l0 _5 d. _! _5 m
  41. #undef EDMA3_DEBUG
    / X0 \8 Z5 i; D' r! v% d9 q5 Z
  42. /*#define EDMA3_DEBUG*/: f( E- G! s' x! z! M9 v  H

  43. $ p, `" f8 x- k/ C' d
  44. #ifdef EDMA3_DEBUG
    8 m" X; n1 l% H) C8 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); b1 ^5 b# y1 Z/ i2 F& C3 {/ B: c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( v- _3 N, y! d# I. A& k: ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      a  T8 l- l2 z6 o* t
  48. #else
    % x6 U2 |8 k1 `, _  a: F0 B) o
  49. #define DMA_PRINTK( x... )  M, g" y2 }) U6 ]/ @6 ]! i% O: E
  50. #define DMA_FN_IN
    * g$ J+ Y' |6 o! R2 J
  51. #define DMA_FN_OUT: L2 j9 Y# z# }2 r; r0 G4 w! q6 d
  52. #endif
    . i" q8 V1 {! C

  53. " h) J# S5 i0 K( E1 N" n6 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , I9 g/ Z2 D6 e1 I$ Z7 H
  55. #define STATIC_SHIFT                3! ~! G1 ]# V2 e. U# V+ G3 P1 C
  56. #define TCINTEN_SHIFT               202 [6 D( ]4 ]5 X: ]' D, h7 m; s* |1 V
  57. #define ITCINTEN_SHIFT              21
      W5 e% Y- R  o5 J- P0 w
  58. #define TCCHEN_SHIFT                229 {: X0 u& c& g. ~6 k7 \
  59. #define ITCCHEN_SHIFT               230 {" A8 z1 \0 q( g$ P% b
  60. : n4 N% [  Y! g% S# F* x
  61. static volatile int irqraised1 = 0;
    3 I  X7 f3 ^  k
  62. static volatile int irqraised2 = 0;* r  c3 k4 t' }: r/ N( x  o

  63. % o9 p* S; i) p& H) ]5 h4 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 y9 r' O8 n& g1 Q. e2 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q" d$ ^; L6 O7 W$ x2 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W. ?' ~  G2 l# G# p6 o+ d9 U; {
  67. : `6 a2 }% O) H8 p
  68. dma_addr_t dmaphyssrc1 = 0;* d5 e8 A+ I- @) B1 {
  69. dma_addr_t dmaphyssrc2 = 0;0 I* ?4 Z& y" C% R4 ], E; F8 O
  70. dma_addr_t dmaphysdest1 = 0;
    ( O0 S8 ~/ R& {7 F6 m
  71. dma_addr_t dmaphysdest2 = 0;- F, o4 ~  m7 u
  72. - M2 z1 S. K: ?5 C
  73. char *dmabufsrc1 = NULL;
    9 z) [7 v% @! [/ r
  74. char *dmabufsrc2 = NULL;
    3 B; T! n9 p- h4 w& y) k) d
  75. char *dmabufdest1 = NULL;6 C4 F0 o6 M; p5 x8 C8 k
  76. char *dmabufdest2 = NULL;
    ; C( A) C0 I/ B* C

  77. ( j) {8 m& I' t- P1 j3 }# b
  78. static int acnt = 512;% \8 o$ ~7 O7 q6 S) @
  79. static int bcnt = 8;
    5 O( {1 p9 F) S
  80. static int ccnt = 8;6 p" G+ X( |9 L' s
  81. * o8 j* L1 D/ W2 U5 F( ?+ l" B
  82. module_param(acnt, int, S_IRUGO);
    ! n& c3 x, |0 X. Q
  83. module_param(bcnt, int, S_IRUGO);
    # M! a' ~5 ?) `3 w! N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: n; I+ e9 Y0 t) @' \5 @
' p( {8 n  f& |4 _3 B/ z  L) n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C+ e" l% A! a6 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ B# ?: j& b% M7 n1 Q7 Y' u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H/ s  p) c7 a) T, N/ n# s
) P: j8 B( b7 H; |0 I3 J
2 v0 g. a( d3 q( f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 03:43 , Processed in 0.044988 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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