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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ C9 w8 `  s) ~! r+ m( [' w
  1. [code]EDMA sample test application
    $ m1 F5 R2 F  c3 B0 A! k) K
  2. /*
    7 C0 o/ X, n1 C9 [. G& I
  3. * edma_test.c9 n3 _- N6 \6 c  ^
  4. *
      [0 P, O4 R0 U' `
  5. * brief  EDMA3 Test Application: G$ T3 i7 ~! _, L: Y! }
  6. *
    3 W/ E* |6 q& `, N8 }! T
  7. *   This file contains EDMA3 Test code.  P& }5 ~9 A, b
  8. *
    & s! W  k+ J) ~8 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & P( G' X7 P# y7 M3 Y0 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 k2 X- Q6 H' q  r
  11. *         TO CHANGE.
    # A0 @0 C$ M1 A5 J9 p" x
  12. *
    9 t4 p! T) A/ `( {7 [6 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! g+ D( J7 K3 Q; ~
  14. *4 X$ ^# \+ f1 c! d5 W# h
  15. * This program is free software; you can redistribute it and/or# V, G8 E/ w2 w6 X
  16. * modify it under the terms of the GNU General Public License as
    * L7 B+ b: k. t& Y
  17. * published by the Free Software Foundation version 2.
    # c# o; L6 G, D" r) e  B
  18. *
    7 F; d& D9 z3 F, v/ s5 N, y$ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 i( B5 r. \& M1 s
  20. * kind, whether express or implied; without even the implied warranty
    ' }7 j0 l! g8 P4 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: I4 p  E4 V6 S/ A, z6 d
  22. * GNU General Public License for more details.
    - C. [  x- d8 r- m9 c4 C
  23. */) S! A& q+ Y! |

  24. ( t# z' H: m- D. f
  25. #include <linux/module.h>
    ; F) j% X% x3 M2 x% X/ H, ~
  26. #include <linux/init.h>9 T- i5 f( K* T& }
  27. #include <linux/errno.h>8 T- L# ?, ^4 q& P5 ^. A+ o8 J
  28. #include <linux/types.h>3 H  `/ _  M+ _
  29. #include <linux/interrupt.h>
    4 c9 Z& Q1 U  b
  30. #include <asm/io.h>
    6 R4 M3 T9 t0 a* S
  31. #include <linux/moduleparam.h>
    * p' {" L0 J. h% A; ?4 _
  32. #include <linux/sysctl.h>
    3 _1 t) Q! J* _8 R* g
  33. #include <linux/mm.h>& w! R* v: T4 Q. ?* N% x% V0 g2 I
  34. #include <linux/dma-mapping.h>
    % P2 `; {6 c6 i6 e! _8 \6 ^" D' X

  35. / G$ b  k) d8 {0 E( V
  36. #include <mach/memory.h>) R$ H; p: x! z/ @" }6 [  G; e! i! v
  37. #include <mach/hardware.h>
    ' w' Z" C4 M+ q/ f
  38. #include <mach/irqs.h>
    ) l' L, A4 n9 ]5 b5 J( q- g+ C: V
  39. #include <asm/hardware/edma.h>: A( ~& D- |$ d5 r

  40. 0 h1 J8 ]4 f7 h+ A5 ], I9 u) T& j1 `7 b
  41. #undef EDMA3_DEBUG% I& G8 E9 J$ e; P
  42. /*#define EDMA3_DEBUG*/7 S( q% a+ _0 I! T* s
  43. . M- @( K9 R$ F2 ?' U8 [  j9 g: b6 M
  44. #ifdef EDMA3_DEBUG( R, A# K' G" L0 S7 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), l+ c9 H/ C- s# P( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @5 e* S; W( {$ e1 v/ T' E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" T& P9 a' L5 Z$ X) }
  48. #else' a" G( Q' H9 ^8 C% z0 t6 i6 ]# L
  49. #define DMA_PRINTK( x... ). R6 l8 A$ c) H! f- \3 D
  50. #define DMA_FN_IN4 `4 U7 l9 J% n% n% n4 S) q
  51. #define DMA_FN_OUT
    . |- l* f" R  e/ |
  52. #endif6 ], k  B" x7 g) Z" o1 ~
  53. 5 H% f- B( H9 D% u7 R4 m6 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 ~2 q) h* v* W  o8 @5 h9 s
  55. #define STATIC_SHIFT                3
    ) r5 L+ J) `" V" P
  56. #define TCINTEN_SHIFT               209 p" f+ R/ O/ @" O% I0 t1 H
  57. #define ITCINTEN_SHIFT              21
    0 ?. j3 U2 z! Z
  58. #define TCCHEN_SHIFT                22% ^" t; Y* E; V( }9 d8 s+ |# \
  59. #define ITCCHEN_SHIFT               23
    + y- N# t( y6 Z
  60. 5 {( M  C' E) y# k; m3 P$ @# S6 O2 h
  61. static volatile int irqraised1 = 0;
    % ~2 W4 e/ N$ n$ o9 L0 t' M
  62. static volatile int irqraised2 = 0;2 ?; \. @; O7 D% }" a, ^) {
  63. 9 B: \% b( [1 c+ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n5 P; r0 \/ Y4 r' m" s# m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I6 L4 k2 r% o. q2 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Z+ g5 M" Z8 E  t) `

  67. . b5 T" [  ^' M3 N2 r( a, d9 o
  68. dma_addr_t dmaphyssrc1 = 0;
    , N* w! i4 J% y* m
  69. dma_addr_t dmaphyssrc2 = 0;
    5 R& v4 l$ W! W, J# f
  70. dma_addr_t dmaphysdest1 = 0;5 U$ F) N- t7 J/ ~
  71. dma_addr_t dmaphysdest2 = 0;
    ! r9 \7 W2 t( [" _2 O

  72. 2 S: ~, ^, X" @( l3 H9 O, s
  73. char *dmabufsrc1 = NULL;4 Q7 b+ t: m" g0 V) d$ y
  74. char *dmabufsrc2 = NULL;2 r8 C; I( {! X. G2 x
  75. char *dmabufdest1 = NULL;# M. u7 {' W& O3 I: U
  76. char *dmabufdest2 = NULL;
    ( ?# X6 w: ~* q2 m( V& w8 R
  77. 4 M  |0 S3 i9 F1 Q
  78. static int acnt = 512;2 X1 n5 J0 W4 t- B3 |* I8 E
  79. static int bcnt = 8;
    4 d! `4 d  y  A2 A/ U3 _2 H
  80. static int ccnt = 8;* d  D& h  V* A6 M" ~2 D( X
  81. 4 @" A1 O, [% Q% M
  82. module_param(acnt, int, S_IRUGO);9 ]& {0 ^  }5 a% Y. F) T
  83. module_param(bcnt, int, S_IRUGO);2 z6 v& V% h6 n9 D& n) R8 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 R( p1 r* r5 H% P" q$ j9 I& J; c6 s2 b% A7 h$ f( \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 Y9 J' C1 N) u- n3 p8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v& R1 {+ o7 c. z& j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 s3 u; p% L5 T8 }5 V" k  P8 P. s4 U
9 \, ^1 N7 o$ ]2 s: T/ m; j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 17:58 , Processed in 0.039405 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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