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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) X$ g+ U4 I* N# \" n6 c  \  m
  1. [code]EDMA sample test application
    - ?2 ]# ?% a' U4 F7 a
  2. /*5 O1 _7 e1 S' b& E6 X" `$ a* C) B1 z
  3. * edma_test.c* g" O3 n. s5 R. i3 {
  4. *
    1 W2 D7 [% p: a. e2 q" f, F( U
  5. * brief  EDMA3 Test Application  f* L# V& f  ^8 y0 K
  6. *
    : m3 |& s# G4 }  {3 G) I( `$ Z
  7. *   This file contains EDMA3 Test code.0 X  b2 M% i* X# J$ g* t( l
  8. *
    ! g, g5 E! N: ~9 D/ A  d2 `$ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! k) g; `. @# @) W0 w3 I. X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 [7 l7 I' a! e5 u* f" o+ k/ u
  11. *         TO CHANGE.
    ' y; i  d6 t1 V
  12. *" }1 d! H# x! U+ R, r% y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J2 N7 c! E; \- `2 Y& T& Y
  14. *" S* }, o+ X& o# P
  15. * This program is free software; you can redistribute it and/or) k. r1 [" s- [  ~! v, w. J: {+ q3 [1 ^
  16. * modify it under the terms of the GNU General Public License as
    " n  M$ d8 t+ S6 \9 F
  17. * published by the Free Software Foundation version 2.( y) C# `3 |; b1 W) \
  18. *
    & ~* G* R- C, ~/ P, Z5 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e- B  d) k4 X* C3 T' _* u; O
  20. * kind, whether express or implied; without even the implied warranty9 M! Y- z2 R# E0 B3 n# D; z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- G' j- \1 M$ A( m' h
  22. * GNU General Public License for more details.- ?' n+ G5 S. r1 w
  23. */
    / E7 i- f' F6 ~0 e9 K& i

  24. % ^! D/ k# ~5 H
  25. #include <linux/module.h>7 p1 X* I+ Y. A
  26. #include <linux/init.h># u& s- R8 y* l$ I. {
  27. #include <linux/errno.h>
    ! F+ G5 h0 l+ @8 V* Q: X
  28. #include <linux/types.h>: G" I1 N8 {+ v$ _2 k7 p
  29. #include <linux/interrupt.h>4 U, [0 Q' j) H% j% P' b3 h- j( `9 I
  30. #include <asm/io.h>
    4 w% v6 y1 `8 i& @7 n
  31. #include <linux/moduleparam.h>
    & d- |, f. s3 g- e) s) P/ I+ X
  32. #include <linux/sysctl.h>
    ' E6 n/ c2 I2 a+ G: _1 i
  33. #include <linux/mm.h>. D! E6 m) B8 X4 N  ^/ W# O
  34. #include <linux/dma-mapping.h>
    % R* m. @9 [, g+ Z) {% W# J7 m9 C
  35. & Y, _2 v8 O- U# K3 q5 `: [& r
  36. #include <mach/memory.h>
    - x! C9 O3 z8 l& w
  37. #include <mach/hardware.h>. t. @3 q$ F: q) j
  38. #include <mach/irqs.h>
    2 I: L1 S9 M% k: s$ f& w: d
  39. #include <asm/hardware/edma.h>
    5 }8 y; @4 @4 x7 {% c! u, T
  40. ; U. O: E8 u; k; o
  41. #undef EDMA3_DEBUG8 V( m5 {) X& `2 j7 h
  42. /*#define EDMA3_DEBUG*/
    + g6 p9 e$ j: {2 |
  43. 6 y% c1 P$ b9 L2 x! p) H
  44. #ifdef EDMA3_DEBUG
    4 Q' f, L) z9 [8 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 Q8 [- g* Z( Y/ F$ o" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ y/ g3 ?1 P. x+ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( q; z. l" v: Z4 x$ k
  48. #else
    / W4 X$ A9 K0 r& e7 B
  49. #define DMA_PRINTK( x... )
    3 X2 B1 X# O9 z) n
  50. #define DMA_FN_IN& \5 r) ~% n( i
  51. #define DMA_FN_OUT5 C+ Z* i! f+ o% ~
  52. #endif
    7 Q+ N3 z; D/ `" r( [3 Z- l' @. C
  53. . A/ I8 G# ~& h+ V4 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" i* q, X4 O, i9 s
  55. #define STATIC_SHIFT                33 _2 S5 ^: s7 `3 F4 G( F
  56. #define TCINTEN_SHIFT               20% t6 g) c& x; ]/ D+ P
  57. #define ITCINTEN_SHIFT              21
    0 U( _& j4 E& X" \
  58. #define TCCHEN_SHIFT                22
    9 d! l9 l7 m7 c2 z: H# E: _* |
  59. #define ITCCHEN_SHIFT               23" V8 E( v# W9 U

  60. # S& A" ]2 t# O% K
  61. static volatile int irqraised1 = 0;  L" G. z7 d; N. ^# K) r
  62. static volatile int irqraised2 = 0;  B, U7 J: y' d
  63. ! P7 }6 G. h3 ?: A6 B: G+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Z2 ?) g6 z7 S5 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f% |# X/ c0 V; V9 Q7 a6 \1 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 h' K2 x. N% r( X6 Z7 j5 Y
  67. " D' ^# R5 k; E; z: W
  68. dma_addr_t dmaphyssrc1 = 0;
    & l) }# A- q" s! A
  69. dma_addr_t dmaphyssrc2 = 0;  k& Q& a9 F2 }+ v
  70. dma_addr_t dmaphysdest1 = 0;
    0 r% }+ S/ K4 o& v6 a0 Z' Y
  71. dma_addr_t dmaphysdest2 = 0;% ^5 D# J8 t) i! }! T

  72. / W5 E! k, H: r( `6 B" O! Y
  73. char *dmabufsrc1 = NULL;
    7 @+ x; |% k( C  ~- f* c+ q
  74. char *dmabufsrc2 = NULL;
    " f4 I  w$ Q% Y) h8 P& g$ {! p5 j: o# z
  75. char *dmabufdest1 = NULL;
    1 i1 t0 i% c4 h: U. m# h: U# y& q
  76. char *dmabufdest2 = NULL;/ M5 a% |5 d$ ~
  77. 3 N0 d9 \" t( I7 Y: |0 N
  78. static int acnt = 512;
    ( \$ G/ t4 H+ [+ G& S* S
  79. static int bcnt = 8;7 r3 Q4 C) o3 e1 h1 z
  80. static int ccnt = 8;
    0 ^" u- t7 N( c! E/ F" C- T% r
  81. 5 A) Q' F/ D/ ^
  82. module_param(acnt, int, S_IRUGO);
    2 K1 m! e: V  A5 S: F; W
  83. module_param(bcnt, int, S_IRUGO);
    1 V$ U, W9 a; E$ {$ l, Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! T' B' u# r, c$ t. J6 d5 ~
, ^! F( t* A; k* @- T: U7 e6 N# H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 x+ }, N) I& a- G8 g  k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ~/ V3 Q+ ?+ J  K  t; `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a% m9 P7 U) ^; |, D8 H
1 a: c3 }: O: C3 K* U3 K! J) V: o7 Q, N) m3 V, l" S% ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 05:03 , Processed in 0.039439 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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