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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 S& T* G# L- J& L7 J; b
  1. [code]EDMA sample test application7 H1 a& s( x4 n) W
  2. /*
    2 l9 C4 o% s  L" \6 a
  3. * edma_test.c: ~% a" w/ n- ?5 j+ a& l+ o0 J
  4. *
    % q. N+ x) m6 b; ]* K; P
  5. * brief  EDMA3 Test Application# J  j% p" o# O' Q8 d
  6. ** D$ F: A, B  i
  7. *   This file contains EDMA3 Test code.
    : ^7 `4 c! F5 z* ?4 X% o
  8. *' E% W; X9 D4 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: R2 S+ i: R3 ~% c0 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 A' f4 |( u1 W9 Z; D4 V6 N
  11. *         TO CHANGE.
    & X- e8 D6 j! A
  12. *& C" n) I' m$ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T3 F# Z) x! A( s
  14. *( s& c, w9 t/ w  j/ X
  15. * This program is free software; you can redistribute it and/or, n9 D4 g2 d2 S# N# s1 _
  16. * modify it under the terms of the GNU General Public License as
    " E7 y; z9 Q9 h0 Y
  17. * published by the Free Software Foundation version 2.
    0 f4 }) U/ g  X  o, a% ^
  18. *
      h% n$ @  k" S$ c6 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& k5 |. n; \, O* H# L" ~2 U! n
  20. * kind, whether express or implied; without even the implied warranty8 E. w, z$ g0 z6 h4 P5 b' m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 {/ o0 z; S+ d! e
  22. * GNU General Public License for more details.
    " h  l! j4 |& Z3 p" T
  23. */
    / H- I; R- T8 e, D+ f2 O
  24. 6 P4 a  P& ^" r/ K
  25. #include <linux/module.h>
      [9 ?' ]- t/ ]2 b
  26. #include <linux/init.h>7 X2 n  I! J* ~6 I0 e& [7 j
  27. #include <linux/errno.h>
    5 @1 s) K3 X/ m4 @
  28. #include <linux/types.h>
    5 J/ \) [; s4 u- E5 T
  29. #include <linux/interrupt.h>
    3 L1 P9 l  F; b4 j) H1 V
  30. #include <asm/io.h>" K8 s4 E% y$ l2 q& p
  31. #include <linux/moduleparam.h>
    % ?% i/ r8 b5 I& M  Q
  32. #include <linux/sysctl.h>3 M: B' z5 Z/ h. t) |, n  X
  33. #include <linux/mm.h>1 D- i1 v' E+ h: o
  34. #include <linux/dma-mapping.h>
    ( p5 Y7 r6 @5 P; C& M
  35. : j6 l) y6 U9 i( |# z2 ^3 g
  36. #include <mach/memory.h>* G! w6 w- V' i9 E: N
  37. #include <mach/hardware.h>
    5 ^+ i( t" d/ A3 `) U; l; x
  38. #include <mach/irqs.h>
    7 w) |, a  N& I" h: _
  39. #include <asm/hardware/edma.h>
    2 Z' @/ [- e$ w" l2 a+ |

  40. ( p) N$ z2 J6 X& {- Z! l
  41. #undef EDMA3_DEBUG
    " q% f  Z9 ~2 K1 R* v
  42. /*#define EDMA3_DEBUG*/
    - i2 k( ~# n) N

  43. 5 n) A7 W/ @) R4 ?# C3 y! K
  44. #ifdef EDMA3_DEBUG
    $ ?4 r  W7 n7 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 n5 |1 y4 {9 g" n' S' ^& @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ b- k1 z* Q( y4 L/ \' k6 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A8 t, R! _9 @, s
  48. #else" p& H. `" j; K- k
  49. #define DMA_PRINTK( x... )
      L2 K+ c! [* w" X4 U: C3 M
  50. #define DMA_FN_IN. }3 L6 d+ S+ t- Q
  51. #define DMA_FN_OUT
    ) s  A" R5 ^' h1 T: p% y$ @% B, g
  52. #endif
    9 z; Y1 N+ d% |, L% q0 r+ ^9 f
  53. # F& C% N6 H  `+ j) v2 D1 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - z4 C  S/ ]7 Q. A& f# |' G
  55. #define STATIC_SHIFT                3( v8 g7 w" P/ ?: V3 Y
  56. #define TCINTEN_SHIFT               202 D9 r: n8 }5 k4 ]$ U2 n) U
  57. #define ITCINTEN_SHIFT              21
    ' h% W! m3 D$ G( }
  58. #define TCCHEN_SHIFT                22
    8 E, T0 v( C1 ?) r$ N
  59. #define ITCCHEN_SHIFT               232 {+ i, a- B' }7 Q

  60. ! ^+ a  J$ ?1 K& Z# L- p6 m' r
  61. static volatile int irqraised1 = 0;
    - k/ K3 \! f1 S1 B
  62. static volatile int irqraised2 = 0;( I  w; I- J1 Z3 J! y
  63. ( x9 u5 R; z: C- I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a& d' T( Z/ F. T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z$ m6 {8 O3 M6 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 j3 W# d8 @; B' j( w9 E

  67. . V# m- J: [; f- P
  68. dma_addr_t dmaphyssrc1 = 0;0 r" u: \/ g- u4 _" q5 ?
  69. dma_addr_t dmaphyssrc2 = 0;) Q' V4 e9 @9 l4 |+ I0 S$ ~
  70. dma_addr_t dmaphysdest1 = 0;
    * g: U: J% S4 f
  71. dma_addr_t dmaphysdest2 = 0;" N( ~. |$ \6 V( V

  72. + N3 v1 g$ L% R" T$ \
  73. char *dmabufsrc1 = NULL;1 G# _. _# y- v3 r0 `) y
  74. char *dmabufsrc2 = NULL;
    $ Z. U8 o7 N3 v) S; k3 F6 v: o
  75. char *dmabufdest1 = NULL;
    , }5 V2 C1 r# q" k5 M$ `& X! y
  76. char *dmabufdest2 = NULL;
    2 K7 [' d/ F' T7 f) e4 R

  77. 2 M2 ^+ n& [. ]+ Z
  78. static int acnt = 512;' u1 q/ Y! V  v* {- _7 P( ~
  79. static int bcnt = 8;5 ?3 \# e2 I  h2 o
  80. static int ccnt = 8;
    ( S0 H& N6 A; k& S) V9 W9 |2 B

  81. % J3 g0 d8 k0 c
  82. module_param(acnt, int, S_IRUGO);
    # U  ^2 u( s' H% W: t& k6 V  j
  83. module_param(bcnt, int, S_IRUGO);
    ; n6 M% J, o; g, K' w" C3 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( d* {% \- ?1 m7 t# J
7 V/ l; H  o5 T( m( w3 |* t& l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ?6 \3 O& j' \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  P. l, [2 ?, \0 A" k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 @  o* `  H: g, K
/ A) f' m: T0 i0 L
4 d' N+ P- M  {7 T' k9 Z; [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 13:30 , Processed in 0.038649 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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