OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( `+ ]5 Y8 |" o
  1. [code]EDMA sample test application6 I2 y5 C# w- o8 c: d
  2. /*
    & L' j1 Z& v. y$ ~9 G1 W
  3. * edma_test.c
    : G6 }4 Y( @7 Z3 ~: i
  4. *( j+ ~& h) ~1 I8 C1 `7 J
  5. * brief  EDMA3 Test Application+ l2 V; P1 P, D
  6. ** B: n$ m1 h; J% e8 C+ H
  7. *   This file contains EDMA3 Test code.
    - H5 q5 G% {5 I8 Q0 V
  8. *
    # |0 m7 ~, B& Q2 C. r+ J  @9 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 q- p2 D4 X& t7 k: a" c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ x- }% \, h* {5 a: b  I$ x
  11. *         TO CHANGE.: ?& y% z/ o/ [" @- U. ~
  12. *
    . c: D6 P1 M1 D* G, q; E" T' q0 k& d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' `' g/ U& b6 H$ \' {! y4 S4 y# d
  14. *& b1 s7 _0 Q$ U3 G
  15. * This program is free software; you can redistribute it and/or( R8 c; `. k( O  R$ _
  16. * modify it under the terms of the GNU General Public License as" Z8 u; q0 u- |' x! ^# P/ l0 n
  17. * published by the Free Software Foundation version 2.5 x+ a5 b3 z- N
  18. *
    , s6 n) }; S( {& c3 d% ?) x3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 K& v( {3 P# h6 W
  20. * kind, whether express or implied; without even the implied warranty. Q: V" r7 f, R7 x# _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' e, J+ m# }  m
  22. * GNU General Public License for more details./ @* M6 y+ p. O* ^
  23. */
    ' C1 q1 a, r. @6 p9 f
  24. ; ?: q9 O0 F' B; O
  25. #include <linux/module.h>+ Y. L7 u- T: S$ [+ n  d3 m
  26. #include <linux/init.h>! V. G: a  H, ^3 f+ w) e
  27. #include <linux/errno.h>
    . F) s" m! D! I' y. q: W
  28. #include <linux/types.h>
    / j" P9 V' z) N0 }  y
  29. #include <linux/interrupt.h>% B3 U0 _7 s! P# s! n; S
  30. #include <asm/io.h>- p+ ~- z7 K& J
  31. #include <linux/moduleparam.h>8 L. l/ N4 }  g+ l0 N# @
  32. #include <linux/sysctl.h>/ H$ }- u6 s( R9 B
  33. #include <linux/mm.h>
    ! k6 w" s8 A0 p2 M/ {( H  L. k  B
  34. #include <linux/dma-mapping.h>
      ^; z: ~2 p/ a$ E  b

  35. , w. s' }" H" i3 T7 i
  36. #include <mach/memory.h>* _5 Z( }# E1 r, V9 t& i6 L
  37. #include <mach/hardware.h>0 h1 ?7 t( _3 U$ O) E- b
  38. #include <mach/irqs.h>) e, r: f0 H7 J' m5 h
  39. #include <asm/hardware/edma.h>
    " s/ H+ d1 ^3 M7 Q$ }3 s; M

  40. 9 p3 P. R6 `3 E6 e
  41. #undef EDMA3_DEBUG- X- a$ J& O  x; C! x' G$ O
  42. /*#define EDMA3_DEBUG*/6 K: `7 o* e* V! T0 e
  43. ( q) X0 v( Z, q& ]( b7 f; g
  44. #ifdef EDMA3_DEBUG
    : H1 Z1 O: ?- W% Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; c  D2 {' \2 C9 L* `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I+ n" G$ j( r& m% Q  z  U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 j  o4 X. W/ b
  48. #else& @4 f3 v4 R! y' M
  49. #define DMA_PRINTK( x... )! m9 X4 O. K, Q" {1 H
  50. #define DMA_FN_IN. P  z8 x$ k+ g( R
  51. #define DMA_FN_OUT; X  h7 s& I' o* |! d, ^' r
  52. #endif- `+ }2 _4 d! G! k

  53. $ D2 ?+ J% w# X$ s& h3 Q& X* @( ?! B8 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 {! {8 b; ]/ m/ \- G& ^2 w  i
  55. #define STATIC_SHIFT                33 ^( C6 ~4 P, `( D4 q" \# G
  56. #define TCINTEN_SHIFT               20
    - I. c$ K1 r9 Q* P1 Z. R
  57. #define ITCINTEN_SHIFT              21
    ! G# h' S) f# U6 v+ K- c
  58. #define TCCHEN_SHIFT                224 G7 L3 I( E+ }8 Z
  59. #define ITCCHEN_SHIFT               23
      ~/ f# z2 z2 f6 K: u: R

  60. . J9 T+ c+ |+ F% z
  61. static volatile int irqraised1 = 0;
    0 Q. t7 G; [  c/ r' ]$ l' I6 U
  62. static volatile int irqraised2 = 0;
    + G5 |/ a7 \) c. G- Z* v

  63. 3 y+ B- O! j# j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j2 ~8 p* z. t- h  H. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 \% o# o: _  D9 e* m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( u) t& s) J, \- h$ P. B
  67. 7 Q; w; H4 k& R2 S- t1 s
  68. dma_addr_t dmaphyssrc1 = 0;) |* j" E! X- }. X/ q
  69. dma_addr_t dmaphyssrc2 = 0;3 @' s1 ]* @0 L' n7 \
  70. dma_addr_t dmaphysdest1 = 0;' ^; o+ S' I- b
  71. dma_addr_t dmaphysdest2 = 0;1 R0 D0 R5 w: i

  72. * B- A  N4 ]" i
  73. char *dmabufsrc1 = NULL;
    ( `5 ?" H* N# {0 h1 ~! E
  74. char *dmabufsrc2 = NULL;
    9 g* Q! l2 u' m" k+ N. B0 j; ^
  75. char *dmabufdest1 = NULL;8 j& v- [! E# K' g0 F9 t* D3 F$ Z
  76. char *dmabufdest2 = NULL;: |! v7 K+ d6 [8 P/ |- B

  77. ( a* ~* F% {5 D& `9 w! _% o. u
  78. static int acnt = 512;
    2 j: C5 C1 `  @$ S' W7 F4 b
  79. static int bcnt = 8;
    3 }3 Q- A$ q& H
  80. static int ccnt = 8;
    0 ]. Q" ^+ \. s1 r

  81.   p9 Z0 w& `2 f+ a% ?
  82. module_param(acnt, int, S_IRUGO);
    * l" Q, `6 ]% B; B$ h
  83. module_param(bcnt, int, S_IRUGO);$ Y9 @& w/ ?5 V" l  m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: `/ P- ]4 R2 ]9 p5 V0 I+ x& l( ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 k- p! ]6 p, [% o% g$ Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# _1 Y* m* y4 O7 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& k2 a9 R# H* X2 q

0 G+ m' M! e4 M; _& G& S, O7 a# Z! ]* N! o6 w! i; ^' S2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 07:58 , Processed in 0.036714 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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