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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 u" _" O8 S, J
  1. [code]EDMA sample test application
    $ W& ?1 X. l, `7 l' ^/ x/ E: X! Y
  2. /*
    ' L$ M8 q5 Y* a& R
  3. * edma_test.c
    + D0 y/ S) \+ k$ I
  4. *4 a# o0 m( M1 r4 G8 F. H& Q
  5. * brief  EDMA3 Test Application
    1 z, X1 @( l2 b6 L
  6. *0 ^7 _- z; J" `- w6 u- V
  7. *   This file contains EDMA3 Test code.+ v1 a8 L& u1 k
  8. *& |( t9 e# B( c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 L  Q- @& P+ }; x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ~1 _% M" m, H9 w
  11. *         TO CHANGE.; v" f" _; r' T8 h! W3 O. j+ u6 p
  12. *' s' Z8 F9 E6 P3 j6 r$ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + Q0 k8 w6 f' l/ }2 I& N; r  a& G5 `
  14. *
    % I  h1 {& w$ x! v3 g9 s
  15. * This program is free software; you can redistribute it and/or" U7 S9 I$ h6 D* {1 z1 S
  16. * modify it under the terms of the GNU General Public License as' b+ ]8 }3 n+ F) U" n4 X0 ]
  17. * published by the Free Software Foundation version 2.1 z) b" j0 [5 l0 Q
  18. *
    " `: e3 w, n) |' G# q1 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * N9 g5 t. F5 E, ?5 e
  20. * kind, whether express or implied; without even the implied warranty
      m+ C3 u$ B+ s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % p% D9 |+ ?: z% E: i- O( {, j
  22. * GNU General Public License for more details.
    ) z$ ?4 C6 l& @- u9 O# u- M
  23. */
    4 }# C3 c+ x8 B, M3 |- H
  24. : J$ v, `+ g* }* O/ a) O
  25. #include <linux/module.h>
    % Y1 [5 z% r: g: [8 S
  26. #include <linux/init.h>4 R3 T4 w$ n( j( V* Y! x4 J
  27. #include <linux/errno.h>6 @+ g  q, ^& T( N/ y. N' Q
  28. #include <linux/types.h>
    ) {! B$ U6 ^! p" f4 X
  29. #include <linux/interrupt.h>
    ! N, ~6 o6 M: [& R3 P# `
  30. #include <asm/io.h>
    ' p+ v/ e$ s2 R) H0 x
  31. #include <linux/moduleparam.h>
    9 G9 {" p1 f8 E( v9 q% t
  32. #include <linux/sysctl.h>
    ! E3 U0 ]7 K8 R! J1 k- r
  33. #include <linux/mm.h>
    ) @( d8 a3 _7 i" Z6 x
  34. #include <linux/dma-mapping.h>; v/ {; q6 ~$ \: O$ D7 x

  35. 8 i7 g" ?. {8 @8 s& E$ M* N
  36. #include <mach/memory.h>4 y6 h5 E8 K3 Y1 j6 F( u8 s" w
  37. #include <mach/hardware.h>
    4 H( P" [% f8 X- I+ ]
  38. #include <mach/irqs.h>2 h7 |/ e4 {, w9 {+ j# t5 l' A1 T) c/ s
  39. #include <asm/hardware/edma.h>- n7 b! S. s3 E' s
  40. - r( k1 f; p( ]6 j' c
  41. #undef EDMA3_DEBUG
    + V5 a/ ]- G5 C; k. o
  42. /*#define EDMA3_DEBUG*/
    2 _7 \6 n4 i1 G. A
  43. 1 H& R! ~6 {! y2 e
  44. #ifdef EDMA3_DEBUG1 ?, a2 I5 o0 `* W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( a, e! R0 M$ b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) O+ A! z1 Z* B! R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + r, \% b, E5 }4 F. u
  48. #else
    9 s! T9 q7 [+ F6 |$ b+ A
  49. #define DMA_PRINTK( x... )
    7 U! a! x+ C. z. f: U' n( P
  50. #define DMA_FN_IN& Z$ B; }: m+ }: b0 a. R
  51. #define DMA_FN_OUT/ k+ [  l3 N3 @1 A+ S% M
  52. #endif
    : e+ n3 W  m: _6 e- K

  53. " ]1 |8 u7 ?* M9 d: P) E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - B4 e4 x  O( ^: x
  55. #define STATIC_SHIFT                3
    & q5 t" I4 A: ^; B  _' I9 b
  56. #define TCINTEN_SHIFT               20
    8 W; m$ g2 e6 o; |4 M
  57. #define ITCINTEN_SHIFT              215 v1 o' q9 L4 T$ D/ j) L
  58. #define TCCHEN_SHIFT                22
    ! I. ]+ X6 [+ Y/ N  E0 T+ j6 _
  59. #define ITCCHEN_SHIFT               23
    4 D" |! h& Z! p' N. J" ^& ]$ S
  60. 6 d: K8 `# P4 {& x) U
  61. static volatile int irqraised1 = 0;
    7 {+ ^( V, k% o5 t- X% X
  62. static volatile int irqraised2 = 0;
    ! \# f% m' K+ w/ H3 _" W& U
  63. ; h( z! g# n  M1 o. H# t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g2 p+ `( N2 ~' {& s: h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 L9 b( H8 L! B& E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l7 V: A% t5 [. n5 R7 E: \

  67. 9 n; ?' A3 u( s  x, k9 c+ ?$ E
  68. dma_addr_t dmaphyssrc1 = 0;
    : }4 J( M9 w7 S
  69. dma_addr_t dmaphyssrc2 = 0;1 ?& }7 T3 g" R  g
  70. dma_addr_t dmaphysdest1 = 0;
    3 v+ B- ]; W& z- M8 W8 r
  71. dma_addr_t dmaphysdest2 = 0;- @4 ~0 v, I! U+ u4 X$ ?& {+ [' o
  72. 5 P2 b' s; U8 x
  73. char *dmabufsrc1 = NULL;( B" _( [5 E# M- |0 r( I: d- m* @
  74. char *dmabufsrc2 = NULL;( \8 E- }# c. v- L; u1 {2 C* Q# ]
  75. char *dmabufdest1 = NULL;! \; f% \. Z" E; ~( }, P
  76. char *dmabufdest2 = NULL;- q( b, q/ E& ?* I& o1 Z/ O6 J

  77. & Y: P% K, `6 H1 \
  78. static int acnt = 512;
    3 o( g& l/ `" W1 E. o/ B, G& Y6 a2 Y9 l
  79. static int bcnt = 8;
    5 e( S# f; s& l2 D' `
  80. static int ccnt = 8;
    8 @3 M1 w: M# X" v# x

  81.   f$ \" ~0 K  C2 q) j
  82. module_param(acnt, int, S_IRUGO);
    / p! e) \  V! V0 P
  83. module_param(bcnt, int, S_IRUGO);2 x7 r; Y/ K( P$ D" _* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ N+ N, h% d, ^( I! R: r) r$ o0 _
4 q: V8 b* T9 Q* ]& ]9 j" x7 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r' ^( M. m3 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 z; A4 s! R: i/ b, P. _( n1 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: g( r- h; y* T: h' q; i

; U0 U. H% H1 c  M' _$ ]9 [( [0 U- c) U+ N. E3 ]8 I, Z. W) R* R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 10:37 , Processed in 0.045080 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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