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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) p: S- G  C8 D/ A4 F
  1. [code]EDMA sample test application
    4 m0 `8 g3 e$ }! F7 t) `
  2. /*
    + y% e# {% q( {: G
  3. * edma_test.c/ \; E9 O  {& ]7 C8 E
  4. *' ^* k) I7 b+ t" S/ t: G
  5. * brief  EDMA3 Test Application9 B9 `/ ]* ?) e% x& J
  6. *
    $ f, N% _( F4 c0 L  x+ t
  7. *   This file contains EDMA3 Test code.' t7 O! P& S. @4 e9 u. a4 P& j" ]
  8. *
    0 ?+ S* ]5 D% `$ c* N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      h+ X0 G1 w" q2 n/ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! k: A: _5 G" @5 L1 _/ n
  11. *         TO CHANGE.$ O  G" R! Z7 o# K7 z  q
  12. *6 h" x$ c  |* I1 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 P+ o: D5 T$ m6 Z! Q1 `
  14. *
    0 t+ f. @3 ^6 `* R  i% |: y
  15. * This program is free software; you can redistribute it and/or9 b$ u) U+ j1 E  {
  16. * modify it under the terms of the GNU General Public License as9 |3 O4 b6 }/ W) s" ~/ ^
  17. * published by the Free Software Foundation version 2.; c# V0 J" w. p, U9 [
  18. *) }9 J4 `  I/ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ `* d( x% `+ |8 E' r
  20. * kind, whether express or implied; without even the implied warranty. E9 e  H/ [0 ~2 }; p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* m, \4 w( }+ A' h' ]& R
  22. * GNU General Public License for more details.5 i" f! t( r3 I9 g
  23. */
    1 R, }: ?- p* G' Y; \. o

  24. % _& ?" t5 A( l# O- V/ a( D
  25. #include <linux/module.h>
    6 j  O+ B) a$ g9 m4 X0 n
  26. #include <linux/init.h>
      m, T& V. l% g6 x7 a6 M
  27. #include <linux/errno.h>
    / E, E9 Y. l; Y* V+ a6 F2 U
  28. #include <linux/types.h>
    9 I" B3 s5 c* B1 W0 ]. _2 e) N# i. Q$ G
  29. #include <linux/interrupt.h>2 U3 i" ~3 z, }8 \
  30. #include <asm/io.h>
    2 x' g; A+ M+ M# s
  31. #include <linux/moduleparam.h>
    ) [  G( G- D  h4 m% J
  32. #include <linux/sysctl.h>9 S* `& c% t: L% r
  33. #include <linux/mm.h>
    $ A2 y9 t2 ], u6 u2 C
  34. #include <linux/dma-mapping.h>
    4 f& T4 I" ~! }% `
  35. 1 O. h# B! C( @1 P. |$ ?* r3 q
  36. #include <mach/memory.h># L8 I6 N6 a' a9 K: W: _$ D7 m
  37. #include <mach/hardware.h>, H# C2 O7 y5 |9 F5 j
  38. #include <mach/irqs.h>
    9 K6 Y( C/ w! R$ o9 H/ _( s" k& U) Q. E
  39. #include <asm/hardware/edma.h>
    / f9 V: ]  V% |$ u
  40. $ e# z2 B' i$ }% v( i+ P- S- l
  41. #undef EDMA3_DEBUG
    + p5 L6 z& P% w6 S
  42. /*#define EDMA3_DEBUG*/
    / U" F- U5 W/ F4 Y$ E

  43. " U: [/ v6 m& @
  44. #ifdef EDMA3_DEBUG* K- z$ u$ k/ n9 K: f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 F: u* n! ]( [. J# q! u5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) M7 s: g( h4 u2 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( M- t3 n" c1 x5 C) J  S4 }3 k
  48. #else3 U$ \' u& H1 n& B
  49. #define DMA_PRINTK( x... )% z3 _6 S# t$ C8 |; P+ k) e1 Y7 g, S
  50. #define DMA_FN_IN+ F* c( Q7 K0 s7 z
  51. #define DMA_FN_OUT& R5 p$ I3 d0 g" C4 t7 h0 T
  52. #endif2 {! N) ^- Y- e, `, z  E
  53. - V* Y9 L6 C7 W- E# g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' l' C) ?0 A- y6 t& b8 W# W
  55. #define STATIC_SHIFT                35 B9 h; y& M7 q
  56. #define TCINTEN_SHIFT               20
    , o* @- e5 W* O  W5 `+ @
  57. #define ITCINTEN_SHIFT              21+ Y3 M1 Z2 s9 W" Z
  58. #define TCCHEN_SHIFT                22
    & m3 o7 m1 F! P: [5 K" Z
  59. #define ITCCHEN_SHIFT               23; p8 @0 B, ]' o6 u) w8 U
  60. $ H! e4 _3 S" w6 H
  61. static volatile int irqraised1 = 0;
    $ E8 q5 H7 @& a8 m( T
  62. static volatile int irqraised2 = 0;
    + i% m/ Z$ X1 g. F3 l' V* J; {$ s2 ~
  63. ! Q) K4 R+ A) v; o7 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W: ]( [5 k7 F3 Q- l5 U! D- n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J; \1 v2 k5 c& r3 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^, I& G0 P4 S7 a! U/ e* Q
  67. 2 H  w+ G; z; q6 s
  68. dma_addr_t dmaphyssrc1 = 0;
    / M! V  A5 N, _& O. u4 L
  69. dma_addr_t dmaphyssrc2 = 0;
    * ~9 M9 e8 R# T$ q6 {
  70. dma_addr_t dmaphysdest1 = 0;0 J' A$ O& ^$ I& x( q6 [, K6 w! O1 T
  71. dma_addr_t dmaphysdest2 = 0;
    5 |1 m! X; X  ^7 z6 K1 ?" q
  72. . @* K  n. z% Z. c* L/ K8 n
  73. char *dmabufsrc1 = NULL;
    5 _% A  K! s5 T
  74. char *dmabufsrc2 = NULL;$ @9 ~9 w3 V$ Z( F/ M0 d3 n% n
  75. char *dmabufdest1 = NULL;
    # w1 u) f# w* g% H1 f5 [* r
  76. char *dmabufdest2 = NULL;
    7 Y" X) c7 z1 b5 r3 c" v/ L: m& F

  77. ) K5 Q  ~( G1 x9 H3 z9 U, u2 }
  78. static int acnt = 512;" t/ O& j; F. P
  79. static int bcnt = 8;4 y, q) D# Y! E2 ^# p- ~
  80. static int ccnt = 8;' E& z, r# \) E' \, s
  81. 0 F6 w1 E! H3 l
  82. module_param(acnt, int, S_IRUGO);
    8 }9 Z# s# i$ ~" y) d* `2 L
  83. module_param(bcnt, int, S_IRUGO);
    7 s3 u: D2 y) s1 B% H( f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ @! B/ D! ]$ v+ ?! l
) A: v' r* G% p- ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# k& v3 r  W# z4 S6 T; D0 v1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, G; w5 p+ p  k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E# T% x- f# J2 @  g$ s0 w
3 `0 l1 ?: y% k% w! I
& q: \$ [. r) C, g, L- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 10:22 , Processed in 0.040811 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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