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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) }2 u1 z. C$ G
  1. [code]EDMA sample test application/ j- l: h5 I5 M7 ~% U6 C
  2. /*
    ' c  w$ m$ N$ p+ m
  3. * edma_test.c( J' F: {/ O& i' N" {8 r) m
  4. *
    4 D# u& y6 D, P9 E
  5. * brief  EDMA3 Test Application
    + R1 @" K6 ?4 D6 Y
  6. *9 \. X0 G; U' q+ }0 M
  7. *   This file contains EDMA3 Test code.
    4 q& i1 h1 V- }
  8. *
    ; h( o6 I7 y+ E  e- |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. }& g+ ^2 _: w3 k% a0 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 _2 |$ P+ c! D  Y4 H! U
  11. *         TO CHANGE.
    5 O6 J" C0 p' a: r
  12. *8 ~  c4 z" f: M5 N" `) m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! A6 @, R; D- U5 P/ w9 Q- g
  14. *& U3 q% @! ]# k/ M: z3 ?3 ]# B
  15. * This program is free software; you can redistribute it and/or1 `- e% T6 `3 f/ e* n
  16. * modify it under the terms of the GNU General Public License as2 z- Y1 K% {# @% C2 p% U, X  C3 z
  17. * published by the Free Software Foundation version 2.
    $ k) L, J; ?0 v* x& {
  18. *
    , P" F6 p( B8 g9 P$ L6 l8 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; V4 h2 f( {/ f5 c
  20. * kind, whether express or implied; without even the implied warranty( e5 F, H, H, n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: f; V2 W3 a9 R- q& f
  22. * GNU General Public License for more details.
    5 @8 {7 v: g( j. T
  23. */
    7 f) y; M8 N3 V' b+ d/ L/ V

  24. : H! `) k! V2 x
  25. #include <linux/module.h>
    % u' J; M, T- P+ T' ]" s) ]
  26. #include <linux/init.h>
    / i0 O  S1 K; V' h; C$ w8 I+ h, }
  27. #include <linux/errno.h>/ \( e: u+ S5 n% U  \2 Y
  28. #include <linux/types.h>0 _1 x: }, [/ Q: H% ^
  29. #include <linux/interrupt.h>) E0 m6 z; P. Y* U* i
  30. #include <asm/io.h>
    & w( u% H$ v( \7 H! E
  31. #include <linux/moduleparam.h>
    5 c5 Z& P' t& D2 E
  32. #include <linux/sysctl.h>
    8 ]  T' |& n* g+ g& y( S1 I
  33. #include <linux/mm.h>  C. q( U* [( H3 W4 N
  34. #include <linux/dma-mapping.h>
    % z$ Z% G  H( V8 H

  35. / M1 g( ], y1 ~8 y4 j
  36. #include <mach/memory.h>/ ?; |# ]$ ]! Z9 Y
  37. #include <mach/hardware.h>' f* o8 `6 u& v  h1 ^5 u( f
  38. #include <mach/irqs.h>
    9 n% D: [% w5 h( C0 s
  39. #include <asm/hardware/edma.h>
    $ c5 j# W9 ?$ D: {+ f/ y# `

  40. . h; i: g! ^5 ^3 F
  41. #undef EDMA3_DEBUG- |& O! ~- `, `/ G1 V( s: z& {
  42. /*#define EDMA3_DEBUG*/
    " o' U7 m% N" G# m' S7 _

  43. ( @7 W, I) n# J# t8 ~
  44. #ifdef EDMA3_DEBUG
    , R  [5 I8 J& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" `& N3 i9 b$ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 o- I: S  Z: a* Y0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " a; E. N& ]' ]4 O" y
  48. #else" i. h: U8 t; J! B& i& z
  49. #define DMA_PRINTK( x... )7 v$ i' z" ?3 a8 c9 K8 p
  50. #define DMA_FN_IN) o  y( e% d& b2 u* I4 J& |
  51. #define DMA_FN_OUT& f. L/ k# @6 y7 g9 i5 j
  52. #endif
    : d8 R7 ?2 o$ O3 ^3 q
  53. & i. h4 q1 {) d" c7 L# S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , c( h9 b2 q# ]- U9 s3 ]
  55. #define STATIC_SHIFT                37 A( I4 ~' I& P! z3 N& q
  56. #define TCINTEN_SHIFT               20
    ' c, R9 ^  ]2 b5 S. i
  57. #define ITCINTEN_SHIFT              21; \4 D/ M! M* a3 H) C  v
  58. #define TCCHEN_SHIFT                22
    ; g' {  g; O2 Z& ^! Q+ ?8 @) p5 B$ j
  59. #define ITCCHEN_SHIFT               230 V+ V/ \/ l# }+ x) o5 t6 [

  60.   M; |3 _( Y  S7 H2 ], A% S
  61. static volatile int irqraised1 = 0;' V3 X5 _/ e# k8 x5 p4 x' d
  62. static volatile int irqraised2 = 0;
    5 m2 _% v! _7 ^: |( ?3 y5 \
  63. % k/ i; P5 @- n; D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / b  M- `" p  P. j6 ?9 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 T' }* x/ C" l0 n2 D$ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E, R( ^/ |1 y3 F
  67. ! h# a' t& V# V$ h0 E: m& a
  68. dma_addr_t dmaphyssrc1 = 0;
    * E0 j" T2 n( t" k# \5 w
  69. dma_addr_t dmaphyssrc2 = 0;+ I+ ~7 O# H/ a! Y
  70. dma_addr_t dmaphysdest1 = 0;
    : T3 F- \) S  u4 K3 E7 [' K  L: o% B
  71. dma_addr_t dmaphysdest2 = 0;( u+ J6 _, p. R' `  S  _8 V) ?

  72. % T0 ~& E) C1 B' ]6 F) K
  73. char *dmabufsrc1 = NULL;1 m7 x4 h& s1 \/ T9 P
  74. char *dmabufsrc2 = NULL;$ ]6 s. ^; W" U
  75. char *dmabufdest1 = NULL;& X' l+ V" d) a) L1 i
  76. char *dmabufdest2 = NULL;* z% D3 e, [" R- R+ Y$ t6 i0 o

  77. ; z% J- A: E' ~  T
  78. static int acnt = 512;
    $ C, g$ O' W& u- W+ Q: b* e1 C6 i7 K! F
  79. static int bcnt = 8;' u8 d+ x: _! `0 p
  80. static int ccnt = 8;
    # _4 c6 r  h. c5 _; V
  81.   X& h! {/ I+ [; e  _
  82. module_param(acnt, int, S_IRUGO);
    * G: l' P9 m5 T- I9 f, U+ s
  83. module_param(bcnt, int, S_IRUGO);: K$ C9 m) d/ k$ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 O& o- `/ \& J
( ^& V9 C& B' J/ B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 \- f5 c) G9 z" o2 s7 _. }, `$ {  Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 c. g* h6 A2 X% y5 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 V" x3 u( Y2 I7 e
+ X( k% ]/ t; G4 ]9 l  T6 q! y2 M6 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 19:17 , Processed in 0.040185 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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