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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  O1 L, x0 a: }* X3 c& Q. a$ K
  1. [code]EDMA sample test application
    . x! u5 c4 O% J' Z" a, t9 d0 q
  2. /*
    2 n* x/ E" b2 I5 `" Y! `& `! v0 ~! z
  3. * edma_test.c" g: C+ F+ c+ ]
  4. *
    / w4 f3 V3 ]* k$ ?9 o2 ^( @
  5. * brief  EDMA3 Test Application8 V* ?- T- r. K. _- k
  6. *
    # H; f4 o0 N; u: k
  7. *   This file contains EDMA3 Test code.& T  M4 `3 w4 u4 I  c
  8. ** q0 q% v. f8 V9 Z2 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - T/ J& {5 |& ^# D" ~2 K# n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) z/ K- {) t% j! V
  11. *         TO CHANGE." D% [) m, q3 N  i5 _" {& @5 s
  12. *
    % l1 ]- i, E# y, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s5 L. h* v) _$ Y* w
  14. *
    * h! K/ c- _  d  Z( N2 v" H2 I
  15. * This program is free software; you can redistribute it and/or
    $ U) [0 i' d* E4 X3 ~" b
  16. * modify it under the terms of the GNU General Public License as4 m, P; S0 ~2 u% m
  17. * published by the Free Software Foundation version 2.
    + J+ ?) H  ]% L  h5 {
  18. *
    ! `8 G: _, G% N% Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 @+ J9 O! e$ w- F4 W$ h
  20. * kind, whether express or implied; without even the implied warranty
    % F3 k$ p1 E' |6 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! I' Y: P# {4 p* N1 H/ d& h4 }
  22. * GNU General Public License for more details.5 U9 p9 d/ [; L% U) _, w
  23. */
    / Z# \" Q" S- Q# J% z' j( l
  24. 5 j+ E3 f8 f4 j/ v1 i
  25. #include <linux/module.h>
    1 Q3 A2 O2 @! t
  26. #include <linux/init.h>
    7 }# `% E( y! Z$ f/ Y* N
  27. #include <linux/errno.h>; p7 B4 T. A0 T4 ]
  28. #include <linux/types.h>
    1 F" l- L4 r1 v
  29. #include <linux/interrupt.h>6 _0 z3 e5 g. c& j6 t8 }
  30. #include <asm/io.h>2 U4 K" T+ x) q5 w" ~9 |
  31. #include <linux/moduleparam.h>: _6 r6 o/ U8 D+ d; D1 Y$ Q
  32. #include <linux/sysctl.h>& ]% a% w3 [7 h" Y3 `3 W
  33. #include <linux/mm.h>
    1 J/ ~- r. \- Q' j  L# k
  34. #include <linux/dma-mapping.h>
    3 F; p6 H' @" X# C8 }! e: y

  35. $ J, A" y& i8 L5 D5 B% h; S) d  h
  36. #include <mach/memory.h>
    0 v2 s) I  _6 o- a) K
  37. #include <mach/hardware.h>1 l; R5 R$ C3 l9 {  M7 P
  38. #include <mach/irqs.h>
    ) l# T$ H0 i% O2 \! _# D
  39. #include <asm/hardware/edma.h>2 s8 h5 R$ x) S8 G) F

  40.   V! k' L! U, ]2 ]( I
  41. #undef EDMA3_DEBUG7 Z) {7 t2 x* J2 G; ?  G0 |$ c- n
  42. /*#define EDMA3_DEBUG*/* Q( t1 o: D7 O0 `
  43. : }8 X. l7 f3 e: T; e
  44. #ifdef EDMA3_DEBUG
    ! G- L0 c3 w, p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ g8 ]: H: {2 z( t9 |( [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 _3 ~  P3 t. Y( F* `9 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ C' `9 i/ D' U4 n: a* q  Z" {1 q1 y
  48. #else
    2 R2 f8 O3 W# x+ Y! ?0 t" C
  49. #define DMA_PRINTK( x... )
      A& k! D0 W1 F* x( @  w
  50. #define DMA_FN_IN
    0 u! l4 L! K+ I7 }- D  f
  51. #define DMA_FN_OUT
    3 w; |& p  G: P: D
  52. #endif) T: K* g7 W7 O% t0 y4 T0 `

  53. 6 ?, `: E, j) [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " x: ^9 l: g! y
  55. #define STATIC_SHIFT                3& G' `! P8 E9 V+ R
  56. #define TCINTEN_SHIFT               20
    6 H8 T4 g8 \' \' S+ _
  57. #define ITCINTEN_SHIFT              21% K) ~1 l1 U% i; ^
  58. #define TCCHEN_SHIFT                22
    7 L# S: a* R$ `! f* q: x, }  H
  59. #define ITCCHEN_SHIFT               23- X" D9 `" y5 W+ t) ^" X2 @& W: y
  60. - F, j# c8 W$ F- ]
  61. static volatile int irqraised1 = 0;
    ; H+ |; o7 r* H* Z
  62. static volatile int irqraised2 = 0;4 F0 p1 }6 i3 r: s: c3 _5 Y1 Z) t0 x

  63. / ?0 {3 N+ M4 E0 u5 {! p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 E$ @3 m- `) }6 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . @, y) H/ ^) T+ d. O- O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / [2 U' b% ^. X- \1 O3 }& a9 ~
  67. ' t( j' n$ M5 a. K$ e. @+ `
  68. dma_addr_t dmaphyssrc1 = 0;
    % l# J, w; l7 }3 _2 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    ; G/ C3 U5 V- @  Y
  70. dma_addr_t dmaphysdest1 = 0;. o, |; m6 Q; g$ ]
  71. dma_addr_t dmaphysdest2 = 0;7 ^. C- ^( R7 S  @; q0 A+ @
  72.   ?) }( |' {4 G- j
  73. char *dmabufsrc1 = NULL;% H% C  s- U9 R) |0 H( D" y* _
  74. char *dmabufsrc2 = NULL;
    1 G- L  {3 R/ `* p9 w
  75. char *dmabufdest1 = NULL;' z/ d- V% k* p/ w  y/ F0 q) v
  76. char *dmabufdest2 = NULL;% ]7 c( J7 _; A5 W- h

  77. ! t6 m1 I! |3 {- }" B: n: j
  78. static int acnt = 512;
    ) B: O2 s! a4 n) t9 Q, }* I$ [
  79. static int bcnt = 8;
    ' {# x: M- Y& S3 I, N
  80. static int ccnt = 8;
    0 }4 Z) ?% d) ^" `6 G. v: c
  81. 4 `! n7 s0 V8 ~5 X, u+ G+ i
  82. module_param(acnt, int, S_IRUGO);2 P# Z( a9 s' L; T7 g+ d
  83. module_param(bcnt, int, S_IRUGO);
    - h) g( T* t' b) H: a8 `, i* N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* k6 N* r  v+ ]9 x1 N  m" `* `( M" d/ F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) @- k/ F& W$ d5 n5 ~3 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: g) Y$ G) |0 J4 k" |" O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q! D# x. X; c5 w9 D9 Z! E' t% r& O
7 c) o- l4 M1 v: K( |$ j+ q, d& o  Q4 W( B- ]7 |& z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 15:41 , Processed in 0.040694 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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