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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y* P2 l9 l- Z5 @
  1. [code]EDMA sample test application9 w+ V  v" I4 k' H4 \
  2. /*
    - u& h- q/ J/ T9 t" f# Q
  3. * edma_test.c
    ( C0 v0 I8 H2 J7 n' |
  4. *! J5 o6 g$ D8 W9 ?8 c
  5. * brief  EDMA3 Test Application- Q/ Q  a0 F& d& ]" |; Q* z/ N, O
  6. *  Q! t8 S- n" B! x, `; ~
  7. *   This file contains EDMA3 Test code.# p  `; i  B& ~; z5 Z6 [0 s
  8. *
    ! u  z$ G: @/ u' l0 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ `6 N) f* M" ~  G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 r& t) o3 S! ?' z2 x! J; I) o" Y
  11. *         TO CHANGE.
    8 O) ?- c! p' B1 t1 F# z, \7 F
  12. *
    # |9 }/ p5 K7 E" S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* e* |/ O( M# v/ l
  14. *
    5 c6 `: Z8 E- Q6 q
  15. * This program is free software; you can redistribute it and/or, O: V* ]2 N3 ~: G  P
  16. * modify it under the terms of the GNU General Public License as- E% m( o+ c6 j: P8 I3 _( r
  17. * published by the Free Software Foundation version 2.6 b- [. n6 K6 W
  18. *2 Z8 k3 A' M# R2 I2 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & @/ g5 I) ]3 R; T- m1 g) N5 ?0 i
  20. * kind, whether express or implied; without even the implied warranty
    ( h+ }9 X0 y" X  \# X9 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( {; [$ Z' Q) R* {0 \. R" T# d
  22. * GNU General Public License for more details.( _5 V2 D7 t3 X1 A
  23. */7 t* M" z- a: M! m5 z7 k) P2 Y8 ~
  24. ) T& O0 A- s: C0 b
  25. #include <linux/module.h>
    4 Z* ?) j4 O' E4 E
  26. #include <linux/init.h>" ^4 \; L0 @" F' s3 q
  27. #include <linux/errno.h>
    - X& j  R  E1 l2 y. I$ R6 t
  28. #include <linux/types.h>
    " _, g. ^5 a  T) C- l& _
  29. #include <linux/interrupt.h>1 O, Y, z' @- {' V4 S$ r2 I
  30. #include <asm/io.h>" x# A2 O* [* e
  31. #include <linux/moduleparam.h>
    , k1 {$ R6 Q, K# n$ a1 _
  32. #include <linux/sysctl.h>
    $ O; X4 R* t* X2 F" I$ [3 r
  33. #include <linux/mm.h>, D' R2 T3 d7 o- E) c2 a' s
  34. #include <linux/dma-mapping.h>+ P; n) ?. U& X! H% b
  35. : x' G3 }0 _( |3 H! q0 }, f% ~
  36. #include <mach/memory.h>
    ; r: u# r$ Z& L. `8 |! J( @. S
  37. #include <mach/hardware.h>, S2 G  {2 u  j! F- t( {9 y: i
  38. #include <mach/irqs.h>
    2 \/ s/ }* F4 M% q- W- p
  39. #include <asm/hardware/edma.h>
    ; F) u* x6 }0 S( G, a4 z& g# \5 l
  40. : b: D, K( V9 q/ L
  41. #undef EDMA3_DEBUG$ Z( N/ M' D3 D% @: @# L- a0 u
  42. /*#define EDMA3_DEBUG*/- P1 P) ]) k; |0 z/ b

  43. & |% }0 g2 D, r8 K  q, b/ ]+ k
  44. #ifdef EDMA3_DEBUG; b9 a$ w) N& [# f* B- _$ M/ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      a6 s, w! D8 v* d) q0 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), b6 e2 {' _# ], K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) i$ R$ T% |& m
  48. #else
    # Y, r* s- {$ r# R8 O0 i
  49. #define DMA_PRINTK( x... )+ C8 i5 ^. ^8 T% Q( i  }4 ~
  50. #define DMA_FN_IN  {$ F# L' y8 C7 X" p8 s8 x
  51. #define DMA_FN_OUT+ Y6 }, l- i' l! C0 a$ }
  52. #endif
    1 d2 U) |6 ?' ?/ p& f" B
  53.   o& B1 f: N/ w+ C$ i1 N. X2 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): R& x( |& b, s, N- k
  55. #define STATIC_SHIFT                3* B( E1 R& \5 n
  56. #define TCINTEN_SHIFT               20
    & n, s# I5 N7 C2 d5 Q! E9 ?
  57. #define ITCINTEN_SHIFT              21
    ! X+ `) P9 b* g2 s% r6 ?) I
  58. #define TCCHEN_SHIFT                222 z& y! k( h7 f0 V+ j
  59. #define ITCCHEN_SHIFT               237 f5 U$ q# ?: \1 c& h9 d: M
  60.   g; ]8 Q$ B+ Z1 A3 e
  61. static volatile int irqraised1 = 0;/ ]4 O8 }# R( {# n1 n, ?
  62. static volatile int irqraised2 = 0;
    . Q: {2 M. A/ v! f0 x* V7 s: E
  63. % Y$ t9 Q* {) y% G/ z3 R) R8 y- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % g: x, s- Y; a# Q5 q! Q2 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 H' @* {  }0 Y$ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k! L8 `* u, \( G1 X  v# J! Z
  67.   I$ y8 C' l; e  l6 y' Z: _  p
  68. dma_addr_t dmaphyssrc1 = 0;
    6 a- N# E$ q/ }2 P! m( H) O! m3 I' E
  69. dma_addr_t dmaphyssrc2 = 0;
    * ~" M7 T3 z1 L
  70. dma_addr_t dmaphysdest1 = 0;
    / j4 n( F  w. S4 Z1 b
  71. dma_addr_t dmaphysdest2 = 0;
    : `% A! t. _2 m

  72. : y8 B& V; p$ t# u
  73. char *dmabufsrc1 = NULL;
    + \1 N, R4 C7 I2 F) k
  74. char *dmabufsrc2 = NULL;1 I1 I, Z+ v- P7 @
  75. char *dmabufdest1 = NULL;
    - C7 ?8 t% w$ U' ]* G
  76. char *dmabufdest2 = NULL;4 u3 S+ n- E3 X: ?5 w

  77. ( f5 F3 {9 M6 ?6 m* A
  78. static int acnt = 512;% o. h$ \' J3 ~2 }$ j, A9 Y
  79. static int bcnt = 8;3 E( \7 G5 b' I* {3 g
  80. static int ccnt = 8;# f& k$ w4 ]! J  O# C6 M$ a

  81.   E1 H! Z6 `- p* S6 R
  82. module_param(acnt, int, S_IRUGO);: w3 g5 _) M& q: s+ U! s
  83. module_param(bcnt, int, S_IRUGO);
    # D' _2 ?. \+ P" _+ ?2 {6 r8 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: g- [! u* e' O+ }
1 j+ ?; x  E9 c$ j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# h: ^, O- B5 L# U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C; s4 s$ f2 U( ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( l5 ^% V" ?. @, a2 S- j
% Z2 b9 O$ g3 j( Q8 q+ H5 K2 h/ W1 b4 a3 U2 `' a; Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 13:30 , Processed in 0.045702 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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