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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h; h4 Z2 }8 e
  1. [code]EDMA sample test application
    7 b2 E2 c6 R' [+ _7 n5 u% m6 L$ u
  2. /*
    ( s" r9 W& {- M+ m/ [
  3. * edma_test.c
    " f, }$ q: E3 I) H; |4 M
  4. *
    $ V8 Y, {! X( H0 M$ d1 A/ b
  5. * brief  EDMA3 Test Application
    % o- q4 o, k7 D* H/ Q! `4 x1 f
  6. *& A+ t1 U1 m- d: a9 d- N
  7. *   This file contains EDMA3 Test code.5 z6 Z* e" o' y! x/ N. V5 n/ N9 H& ]: j
  8. *
    2 L+ U7 w% V' x7 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ J% l$ u" z" j: ], s4 ?; T6 Q; w. w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 r" C  w2 I8 W8 G' x: }; u
  11. *         TO CHANGE.
      _) O& P0 r" q$ A8 y
  12. *
    5 s1 J5 N, J8 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + q% g" K$ Q. E( M7 C
  14. *9 ^9 |1 s  A8 V
  15. * This program is free software; you can redistribute it and/or
    / v: [, l# G# s) I7 x" j, q+ c
  16. * modify it under the terms of the GNU General Public License as  V- A+ M0 g$ `' o1 Y! |
  17. * published by the Free Software Foundation version 2.
    / V1 k4 P) U7 Q1 B
  18. *
    7 I& K+ `5 G+ @6 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & e$ h$ H3 d% n. \% T; o- i7 H/ W
  20. * kind, whether express or implied; without even the implied warranty
    : l! c9 p) i# ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 W$ u- m7 b+ ?+ m, z9 q  T! l
  22. * GNU General Public License for more details.2 V" e) }# i5 z5 ]6 d) v
  23. */
      s+ ?' F$ U- n( j6 i9 K; Q' o
  24. * a5 n0 z0 R& W* G* G  g0 J* d
  25. #include <linux/module.h>. m  ]2 c5 ^- Z: T+ Q5 e9 @
  26. #include <linux/init.h>" c2 S) O2 E2 S. I
  27. #include <linux/errno.h>: O* N1 W$ r: X5 I$ {7 {$ m; d/ h3 m
  28. #include <linux/types.h>8 v4 j3 c$ Q# s) `+ s: p' h
  29. #include <linux/interrupt.h>" C( x& m: f6 s3 q( X+ K
  30. #include <asm/io.h>, W- o6 c9 Y0 u  v3 J
  31. #include <linux/moduleparam.h>
    9 Z. W0 @/ b, ~
  32. #include <linux/sysctl.h>
    2 i2 }# A, }4 ]5 K& W6 j
  33. #include <linux/mm.h>
    7 P* L1 d5 C6 u. [6 p6 Y. Z
  34. #include <linux/dma-mapping.h>  [6 e/ W0 d! [1 Z: I. D
  35. : K) d# {$ N# P$ M4 ?  J7 }" X
  36. #include <mach/memory.h>
    2 G- P/ Z/ G/ l$ k  x/ u
  37. #include <mach/hardware.h>
    5 g% E5 U4 L* @& \) T/ x% C; U
  38. #include <mach/irqs.h>. T% n# K; q# x3 l
  39. #include <asm/hardware/edma.h>
    % a2 L" J# h. ~5 M+ e/ x

  40. ; m/ X9 _3 k, ~4 Q. I8 ?
  41. #undef EDMA3_DEBUG, \% e6 y% K. f0 M8 ^  `
  42. /*#define EDMA3_DEBUG*/
    : @9 y% z. C  f  p1 P4 ?
  43. + r9 {6 D, c- X$ ]! P+ A3 f- O: J
  44. #ifdef EDMA3_DEBUG9 t# Q( ^& H6 X0 v) r- @, d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% q+ q. C; Y9 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 V5 w& t( Q. O2 X7 s- q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 \% J6 r3 l  e$ _% O( Q  B
  48. #else
    " f" y8 p) g/ I6 p
  49. #define DMA_PRINTK( x... )" Z: X) Z) f% y
  50. #define DMA_FN_IN) W  _" U7 Q+ q$ v; b3 ~
  51. #define DMA_FN_OUT6 R) [2 t% S' w7 A
  52. #endif
    2 V5 d! U; L# p( w+ H! y

  53. # d9 w/ Q6 Q4 a8 }) D- v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . [1 u) R& ?9 c& U2 ?& b. A
  55. #define STATIC_SHIFT                3% K. W. a5 N0 g% P5 `
  56. #define TCINTEN_SHIFT               20
    $ e  U' k" l9 n' u
  57. #define ITCINTEN_SHIFT              21
    # c  g, W6 f' c
  58. #define TCCHEN_SHIFT                22
      u0 `5 g) L1 a
  59. #define ITCCHEN_SHIFT               23# [1 `7 f2 z+ ^) h# P- Z7 _& k
  60. 2 W9 f/ Y; v& a# g5 }
  61. static volatile int irqraised1 = 0;+ u5 j( A. k+ B7 q" ?4 K4 h
  62. static volatile int irqraised2 = 0;" k/ Y# N! h, [
  63. $ v5 L6 p' H& _; o! |4 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 c0 ^! u1 p2 f8 ~- q+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B" G6 X& {; O- K7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D2 L- ]$ j( ?1 c

  67. ; O8 c$ O& F4 D' L  d
  68. dma_addr_t dmaphyssrc1 = 0;9 F4 O% U0 y9 |9 q
  69. dma_addr_t dmaphyssrc2 = 0;
    6 S6 O; s! D$ ^( G" P  I
  70. dma_addr_t dmaphysdest1 = 0;
    0 n* e" S6 B8 F& [
  71. dma_addr_t dmaphysdest2 = 0;$ ^1 r4 S3 r4 s; s- C* [

  72. 9 J! h1 X! O  y% k& e' X1 L
  73. char *dmabufsrc1 = NULL;
    1 s; q$ ~; V+ J+ b& u. q3 a
  74. char *dmabufsrc2 = NULL;2 Y) S% t( P$ {( X' y2 S' D3 m
  75. char *dmabufdest1 = NULL;6 S/ g: L: W* m7 R2 h8 F5 v7 U! M6 O
  76. char *dmabufdest2 = NULL;
    : \: i: M/ W' v
  77. + K/ p7 K( _# V$ @8 G
  78. static int acnt = 512;  J7 @' E2 `$ O& h
  79. static int bcnt = 8;
    4 H- G: ~3 W4 V; F, a- Q( X) _
  80. static int ccnt = 8;( a( D$ d7 S# `+ Y
  81. 0 B+ A* _- ~, k8 m
  82. module_param(acnt, int, S_IRUGO);
    + m5 z/ o2 c1 b+ W* L) |
  83. module_param(bcnt, int, S_IRUGO);* X3 G7 z, B5 k1 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! B! r9 X4 z: C% @+ g1 Y
, |8 e, }% {& S7 C" c4 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 r3 p+ q0 T8 I' T/ R  h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ^" v' ^0 O, X' h' n: M" r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 s$ X$ v# `  m5 L" x
4 F" j& I" d% f0 Z

6 F8 J  F6 b9 U/ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 16:59 , Processed in 0.040244 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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