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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 J6 H/ R$ B" v2 A$ ?) ~8 _
  1. [code]EDMA sample test application( ]! H5 p7 ]+ T
  2. /*
    4 l6 V1 o7 e# J" \1 z5 l! x
  3. * edma_test.c
    : ?% Q& c# N. M, r
  4. *
    ; o+ D/ ^% R( I3 u5 U
  5. * brief  EDMA3 Test Application
    ( C- [  S: z, h- p
  6. *
    # X2 o4 E5 |0 z* x
  7. *   This file contains EDMA3 Test code.
    7 z& t, S4 M( Z1 B1 |
  8. *
    * d* @, Q; \/ }+ Z3 u5 [4 }8 P, `( T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ?7 ~3 ]+ b; M. L0 z6 L& y; v6 e1 @, D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 k7 Q% l9 D/ E
  11. *         TO CHANGE.
    - P# w; W7 z2 n1 ~" {* q, Y+ v  v
  12. *. I% C8 F7 c1 O$ {9 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ T2 u0 G/ O1 s7 I' Q
  14. *! H7 i- ~  }- V
  15. * This program is free software; you can redistribute it and/or
    / E" O+ a+ U  I, q3 z1 E
  16. * modify it under the terms of the GNU General Public License as/ A$ ^% Y3 x" c; ?8 k
  17. * published by the Free Software Foundation version 2.
    0 U8 J. [' k8 T: t+ o. c1 ^
  18. *
    . s# k( Q' h; `+ g' R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / x8 d8 }2 S' Y: A/ S
  20. * kind, whether express or implied; without even the implied warranty3 ^3 u$ y. c. ]6 n4 Q3 ~9 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( ]- s5 M. \. o+ C- u$ m4 B0 q4 W! G
  22. * GNU General Public License for more details.
    : m; h; l$ L4 [$ R" S+ G9 _& T
  23. */
    ; f7 `$ q8 J+ E/ k" u* b

  24. ! G' r9 p1 Z& z1 Q. s  d
  25. #include <linux/module.h>  D1 N2 p; ]3 S# F
  26. #include <linux/init.h>* U6 o5 @$ o- h) b
  27. #include <linux/errno.h>0 {" n) h' M( ?
  28. #include <linux/types.h>( u3 u; ?: s2 m# \- ?
  29. #include <linux/interrupt.h>" y8 i& k9 [$ w/ `3 Z2 I; ]
  30. #include <asm/io.h>
    ( Y7 ]0 p! j3 `/ O6 Z7 `0 n# O
  31. #include <linux/moduleparam.h>
    , {; g( e, B/ x6 j
  32. #include <linux/sysctl.h>/ a* [: @1 Y6 a' E1 x$ o, L% E
  33. #include <linux/mm.h>
    0 H& f5 ~; {. G6 w% Z/ C9 I
  34. #include <linux/dma-mapping.h>6 G& H# T( [) ]' Q) D0 y

  35. # s. \- ?2 X% }. a" ]. D! x
  36. #include <mach/memory.h>
    + _. \+ b4 z. R$ G' N' N* m
  37. #include <mach/hardware.h>
    # c& Y) ]% v( c
  38. #include <mach/irqs.h>
    9 t0 a- f: {' l1 x
  39. #include <asm/hardware/edma.h>
    4 S' w0 a8 Y$ w, k9 \
  40. 7 J  J4 }/ t/ j1 h; ]0 N1 ~# j
  41. #undef EDMA3_DEBUG# Z5 O8 L6 `' y: B
  42. /*#define EDMA3_DEBUG*/
    - {3 u. l) Z9 P$ W5 Z
  43. / \- M* v4 A+ s2 I+ |& P3 `# A& A
  44. #ifdef EDMA3_DEBUG" g5 r2 k3 d7 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]9 w& x1 [/ \# p$ r) P1 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# y2 G' H& F! K# t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 F% z! a' ]$ _. z# }$ ]& _
  48. #else- m/ t) j! R- v: J
  49. #define DMA_PRINTK( x... )1 L+ z+ k9 @3 m6 w  c. I- [
  50. #define DMA_FN_IN4 x  O, L/ B% M3 h1 {- J
  51. #define DMA_FN_OUT% R& |; A5 k* R% Z
  52. #endif
    ; K& [  u+ o9 f2 f* e* n5 [+ R

  53. " {' z6 A+ D. o8 ?( a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 K7 x1 {. h! k" @' F7 G
  55. #define STATIC_SHIFT                3& h1 f& I- b0 B" H6 \8 O% O5 R
  56. #define TCINTEN_SHIFT               20- H( a9 z$ ?2 E: \
  57. #define ITCINTEN_SHIFT              21
    - H% p. K6 w9 k2 |
  58. #define TCCHEN_SHIFT                229 g3 W. x% b& e$ G$ j3 Q$ a3 ^
  59. #define ITCCHEN_SHIFT               23
    0 M- ^9 S' C- ?% u

  60. ! W' J3 b1 b4 M4 r6 M% Y& Q
  61. static volatile int irqraised1 = 0;; o' A) S5 f* T/ W- V: G( R) T
  62. static volatile int irqraised2 = 0;) O+ V) Y5 Q" R: o2 n; r& W

  63. $ |$ v0 [) ?4 ?/ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D# `2 Q0 Z) |- B/ ?: a5 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 C; V" }% Y1 K6 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " M# h7 H! Q/ I* L
  67. % g5 d5 @# m/ ~
  68. dma_addr_t dmaphyssrc1 = 0;+ \, l- w. T" N3 w
  69. dma_addr_t dmaphyssrc2 = 0;
    1 F4 e% L! `0 m: K* c- F# D* E
  70. dma_addr_t dmaphysdest1 = 0;
    0 J' K4 H. _! R- {/ n0 O
  71. dma_addr_t dmaphysdest2 = 0;3 _- D4 s2 n" v  U

  72. 3 c8 ?8 @" @$ T5 C
  73. char *dmabufsrc1 = NULL;
    2 u; l( ?, U: q
  74. char *dmabufsrc2 = NULL;
    ' `) J1 X5 C+ g
  75. char *dmabufdest1 = NULL;; d2 I1 v: O/ n% s5 A) N
  76. char *dmabufdest2 = NULL;; \# f8 P7 g' h4 P4 A
  77. " }' t0 L4 A, Z/ ^& E$ A/ m
  78. static int acnt = 512;3 R# d1 T+ k* @2 O" \+ h, m0 Z
  79. static int bcnt = 8;/ D! P5 W/ N  {  [
  80. static int ccnt = 8;
    % v2 ]5 q$ P3 `0 @

  81. ( J7 b- L! m. n9 C) ~- P; Q
  82. module_param(acnt, int, S_IRUGO);
    # |" ^; {6 X7 R& t* x- L
  83. module_param(bcnt, int, S_IRUGO);
    6 [: n) V9 a" z- J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! f1 C2 ?3 r+ y) R+ T1 E# @6 a& R. I% t1 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  y$ W' y/ ~: Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ q) ]. q+ \- v' |0 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 r* E+ k* v' V& X5 n
+ ?" p6 C2 I' b; S8 f& g  `' u% u8 ?+ r1 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 09:27 , Processed in 0.040584 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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