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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k( p. ?$ y: W+ v- M$ f% J
  1. [code]EDMA sample test application
    % P" D$ {- O. @) X
  2. /*
    . }# a# p- L% \: f. ?9 T
  3. * edma_test.c
    2 M) f! H1 w6 A
  4. *4 B* J5 K) `- s9 k4 F+ l
  5. * brief  EDMA3 Test Application
    $ m! U3 P/ o- L' Y
  6. *2 |  f6 m  p/ O( _/ h
  7. *   This file contains EDMA3 Test code.! ^% s) A  [) E
  8. *
    5 l; ^; e8 S. C, x2 v% t3 o, X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Z7 r7 [( ^  @% `/ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 s3 F! y4 Z; |
  11. *         TO CHANGE.+ f; Q! J( {$ O; }* N) E
  12. *3 ]2 s# O5 N2 J) i& z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - u9 i5 @  I' S2 K8 u! ?/ P* L) w
  14. *
    # b6 F# \, H1 A* J( e3 U
  15. * This program is free software; you can redistribute it and/or
    + R- W/ e" k/ Z" A
  16. * modify it under the terms of the GNU General Public License as/ ?% d, B4 [4 ]" e: p
  17. * published by the Free Software Foundation version 2.
    6 u  B" n6 Y$ i: k% D8 d. j$ E
  18. *
    ( Y! [- t+ s7 Y& b" C# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / N7 X2 o1 g7 ?1 C5 x4 |3 a  A
  20. * kind, whether express or implied; without even the implied warranty
    * t7 r) E7 n4 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( J8 `/ P( E2 C& B: }1 _+ W2 f& a
  22. * GNU General Public License for more details.; \) H1 a& P, B- i
  23. */' o' L$ q" p3 w7 n4 f; b- }  F

  24. : x# l. v% M7 Y4 G
  25. #include <linux/module.h>
    + R! i' `9 @, l" z7 h
  26. #include <linux/init.h>6 ?- D, [. K3 V" y
  27. #include <linux/errno.h>+ z* W! S' z: w! z% z8 C) `
  28. #include <linux/types.h>
    / N+ p; o+ l/ \0 |
  29. #include <linux/interrupt.h>
    7 D9 x! F9 R) n
  30. #include <asm/io.h>; A2 P  E5 t+ [" o. {: r
  31. #include <linux/moduleparam.h>$ P- @2 f4 e2 P3 ~/ u* `
  32. #include <linux/sysctl.h>
    $ m) X' t5 \2 a4 W5 o# `7 a4 _
  33. #include <linux/mm.h># i# |* t7 U* T0 T: @& A5 w8 b, O+ J
  34. #include <linux/dma-mapping.h>
    4 x2 s' G) g% t8 o0 g: e; O& K; k

  35. . X  E$ i& x5 U* a
  36. #include <mach/memory.h>
    ) h. t' r* j, R6 _! V: {6 ~6 V
  37. #include <mach/hardware.h>: o7 J; S' `+ Q! {: L( m, S
  38. #include <mach/irqs.h>
    : b' w( u7 j* J3 ]- n; ?
  39. #include <asm/hardware/edma.h>
    , F4 r4 _+ S: W% e0 d
  40. ) J4 q; K; z+ Q: ]
  41. #undef EDMA3_DEBUG+ a2 a3 J+ {' ~1 l; R, }1 i0 G
  42. /*#define EDMA3_DEBUG*/" s* q* {) s% `

  43. ! N4 U+ a" p, K4 @( t. g
  44. #ifdef EDMA3_DEBUG  n- M/ a: k+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u" {- R5 y% ?0 S5 j1 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 V& ~$ _8 T" P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 Q- `- @; O" d! W" @+ U* R
  48. #else
    0 u3 F3 Y6 }* Q) L3 J3 [( @
  49. #define DMA_PRINTK( x... )
    9 u) ?( g5 E' I
  50. #define DMA_FN_IN
    2 e4 H  Y! s) G. p  L- y: e
  51. #define DMA_FN_OUT6 a% l$ ]2 y) e9 k& e. _3 c; E
  52. #endif0 j6 H7 G8 y: u, [' ]4 ~) D0 F
  53. * L7 D" m' n: r# r/ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( @. p$ S) S  s% v3 h
  55. #define STATIC_SHIFT                3! q  Y% X+ Q! i, l7 u( x
  56. #define TCINTEN_SHIFT               20
    9 w; a+ w6 R9 |* V
  57. #define ITCINTEN_SHIFT              21- D; d; T1 B5 C& n) y* x! P2 L
  58. #define TCCHEN_SHIFT                22
    ; [4 B5 c, p8 a
  59. #define ITCCHEN_SHIFT               23+ `% I7 @* c) i% X

  60. ! U0 C, ^* T$ u3 S% g2 h
  61. static volatile int irqraised1 = 0;5 d1 t' `" G' G
  62. static volatile int irqraised2 = 0;
    . r3 I7 d- Z2 P- L9 e/ I/ }
  63. 5 u( q3 C6 K5 R/ }7 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ~3 J2 X: D+ S+ ?) J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B- X( g$ s( y3 c6 e5 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ?# R! B) L7 x

  67. / H, S. h7 Y5 ~  _* I/ U. @
  68. dma_addr_t dmaphyssrc1 = 0;( P) k; R& _, x% l% X6 _
  69. dma_addr_t dmaphyssrc2 = 0;
    2 N, E$ w: B9 h
  70. dma_addr_t dmaphysdest1 = 0;! k5 b/ G5 K7 E8 m8 j
  71. dma_addr_t dmaphysdest2 = 0;7 v" e: g/ g8 M3 \/ P' c
  72. - j( I( I' |% u' r, p) ^* c
  73. char *dmabufsrc1 = NULL;
    5 N6 x/ e* X4 U) a! F1 Z
  74. char *dmabufsrc2 = NULL;
    ; {! }) y6 l) K3 Q" y
  75. char *dmabufdest1 = NULL;
    ! X4 }7 y5 i% o. Z
  76. char *dmabufdest2 = NULL;; c% ?8 Y. T/ V: \% i8 G) Z
  77. 5 y. j; ?1 F4 d# _; x1 y% T
  78. static int acnt = 512;
    7 W* k$ H: V3 u2 L& _" N$ ?
  79. static int bcnt = 8;5 O" h  k- r2 j1 k: _  X
  80. static int ccnt = 8;
    ; F5 W: [0 j6 u/ m/ t

  81. : U' Z! h; S- [0 u& ]
  82. module_param(acnt, int, S_IRUGO);+ F. t3 Z$ v: k( _
  83. module_param(bcnt, int, S_IRUGO);
    / M/ y- M/ q+ r1 _8 x. ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! `! j5 Y% G- |7 C
1 V; f9 f# T- T, h; T1 S2 v6 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 f" H7 I0 x- P) o& Y% N( L/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 f* U; J! ^7 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 R5 [3 }- F. y
+ h) U& k) h. E( l) R" T8 O
  i. B: N5 k: s2 k1 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 07:30 , Processed in 0.039630 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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