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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 h, w/ L% o; \' `5 x
  1. [code]EDMA sample test application. Q) V6 D# U  B4 V) @& d. D3 ?; Y
  2. /*
    3 ]- o1 p6 C" m: |; c9 ~3 M4 S6 B
  3. * edma_test.c
    6 b' p; F1 }% k$ t
  4. *
    # _- N) A& k& I* z$ d! Q/ m
  5. * brief  EDMA3 Test Application
    - u  O- C6 C4 w- t! s
  6. *
    & ^' W8 s. w: [# J/ w
  7. *   This file contains EDMA3 Test code.1 y8 f. ?* M% [. t3 `& ~
  8. *
    4 [( ?6 u% P3 T5 W6 A% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 ?+ m3 i5 O( S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  d9 F$ Y; e- [5 @" ]7 _* W$ @
  11. *         TO CHANGE.
    " r) ~1 t. [* A) R* P- `6 t
  12. *
    4 }' v# j. n" j. Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ M" O* l1 }8 n1 z, `1 o
  14. *
    " _$ @: Q. ~3 D4 m& i, w  ?% j
  15. * This program is free software; you can redistribute it and/or
    3 ~6 o2 m* d0 o1 J1 H$ Q; z
  16. * modify it under the terms of the GNU General Public License as  h6 u* o3 ~& I
  17. * published by the Free Software Foundation version 2.! b; K5 l2 Y. S. {( I1 g
  18. *
    5 S: R- }" s! \+ s, O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( c" N, J7 ^2 L; j* Z  j. T& O  z
  20. * kind, whether express or implied; without even the implied warranty  Z) p( [4 k$ g) q  U  h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " n4 S) `  M  Y7 Q9 \7 r
  22. * GNU General Public License for more details.9 T3 D9 H* U/ e7 I2 }
  23. */
    / K/ ?! x" d' S. f! j
  24. # [" U9 {0 E4 N; w
  25. #include <linux/module.h>
    ( N" H" u# B) g) t: B
  26. #include <linux/init.h>
    0 ]; X( T2 D4 G/ N- ~# q  L
  27. #include <linux/errno.h>
    0 W3 g" t1 G! f
  28. #include <linux/types.h>
    0 L& D7 ]3 ~1 }5 J' k5 ~
  29. #include <linux/interrupt.h>
    0 G7 M' u6 z/ n8 E
  30. #include <asm/io.h>! Q& V3 C2 [; i) z5 l; l
  31. #include <linux/moduleparam.h>( y0 }8 m) _: p9 L3 c5 Z. @
  32. #include <linux/sysctl.h>: r1 ]+ \- r9 r0 m0 {6 V
  33. #include <linux/mm.h>) W+ m) ?: I. G6 D+ I
  34. #include <linux/dma-mapping.h>* b! k( l3 i. T" [* U% ^- x

  35. - }8 z5 z1 \- Z
  36. #include <mach/memory.h>  ]$ d! l" i+ l( {8 L) U% a4 p7 T8 D
  37. #include <mach/hardware.h>3 p# ]2 c% \8 {: V$ x# S' }
  38. #include <mach/irqs.h>/ d- f" o0 q# s5 ]5 g4 y8 Y/ g2 u
  39. #include <asm/hardware/edma.h>
    6 K, S2 F% d1 H5 h

  40. & f  e: W% B$ ]# c+ r4 c0 i' u
  41. #undef EDMA3_DEBUG3 c; T: g- p5 V$ @1 Y+ P  r2 F0 @
  42. /*#define EDMA3_DEBUG*/, @" p. B( `/ v& G+ ?% N
  43. 0 i( @) p4 O/ N8 q
  44. #ifdef EDMA3_DEBUG% i% |- p6 T* G  }4 o0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . n5 r- }: h3 F1 g# i" x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( k5 [* S% C5 b2 h* c$ I6 U: `/ A* Y. |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y  p' c5 H) v: F7 |! z, }
  48. #else
      @$ P* A7 u# X' _
  49. #define DMA_PRINTK( x... )
    - y9 }" w, Z. b- Z. C7 H
  50. #define DMA_FN_IN4 z% u* r; r$ a/ M8 f, E
  51. #define DMA_FN_OUT% q' v8 X* j1 c! y6 ^
  52. #endif+ R4 A# {- ?8 {' b0 _+ e2 o
  53. 6 a9 ]! K) O$ L5 n4 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 h0 b* u6 K2 `" V
  55. #define STATIC_SHIFT                3; v! T1 Q* G: g- }4 I
  56. #define TCINTEN_SHIFT               20
    5 T' c6 a9 ?! f% q" @
  57. #define ITCINTEN_SHIFT              21
    ( k# G( \; H' I4 v$ |1 H3 `
  58. #define TCCHEN_SHIFT                22
    . C& x* b5 Q5 u- Y
  59. #define ITCCHEN_SHIFT               23
    $ B6 d9 X! g( ^1 _( E9 @: K
  60. 6 y# I3 d5 z& N9 o. q( S& f: J( I
  61. static volatile int irqraised1 = 0;0 A. ~9 Y& w: c, S
  62. static volatile int irqraised2 = 0;
    5 h* [6 x4 f7 @* t: }0 w
  63. 8 Q6 e# H+ Z) O9 N# P  J4 Q# M; v- C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L9 z  u; `$ z2 s% n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B- N3 w$ ]  h; Z: X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " q# j0 a# O" J. Q! m2 k9 l5 B

  67. 1 H1 ^( a! y  R# `) ~- M3 ^' Q
  68. dma_addr_t dmaphyssrc1 = 0;
      F, U0 M( H! m! A
  69. dma_addr_t dmaphyssrc2 = 0;
    * A: {' q# B1 V% M( s
  70. dma_addr_t dmaphysdest1 = 0;* c& l6 x9 Q. D" h/ F  i* Y
  71. dma_addr_t dmaphysdest2 = 0;8 N0 p$ V5 H% |' A, s

  72. - I. {: L  i$ ]& E9 _) V
  73. char *dmabufsrc1 = NULL;
    9 x4 K' [9 M2 w9 T9 O* P0 G
  74. char *dmabufsrc2 = NULL;
    ' c* T4 j' d8 `2 S, b/ w' r
  75. char *dmabufdest1 = NULL;3 x. N7 s  ?1 `% |; N, @2 P, {
  76. char *dmabufdest2 = NULL;6 c/ M& g7 J1 r4 e  C7 {9 ~; Q

  77. / |! p6 M; o5 W$ O9 v, \) H3 x. R
  78. static int acnt = 512;
    - T5 L% D+ ]7 K( E% ~; T  f3 c0 k
  79. static int bcnt = 8;
    ( m  D  a0 a9 d/ d' q0 `! p& z. v
  80. static int ccnt = 8;& O, _- E; Z( p% d- ~  [* K
  81. # ^) q+ \! H1 ?: F: ?
  82. module_param(acnt, int, S_IRUGO);' H4 |/ w( l2 A: e7 k$ [
  83. module_param(bcnt, int, S_IRUGO);* u9 n/ [$ [' q6 e) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 r" l( d; r8 Q" h/ e' {% r& f  y6 `8 `9 o# V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 J" }6 g4 {) B; ?" K, k- Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. @. D' o& ?# U% ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V! r. D$ h6 g+ N  `

$ o7 |- F& Q% v" i
3 t0 t6 [' b+ D. w7 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 16:32 , Processed in 0.037469 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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