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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c7 k5 j8 e- |9 u4 L
  1. [code]EDMA sample test application
    * X5 A1 U0 |' v  [' w
  2. /*( B4 h; x3 ^: o7 E$ t
  3. * edma_test.c
    ' a& v4 b. B+ v/ g1 I- N0 s
  4. *
    4 q5 f, a0 C; l( V- [: G
  5. * brief  EDMA3 Test Application2 U' \& t# A4 O' }- F
  6. *" _$ y5 b$ g7 @" o, H; A3 V) @. J
  7. *   This file contains EDMA3 Test code.
    3 l+ S6 n' Z9 q* o
  8. *
    . W- o/ c2 i' _, v" u% W! W0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 N8 R5 j8 Y; ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, _+ r" \3 i. A# i  w  S0 h! ]
  11. *         TO CHANGE.# e" G: Y+ s( c0 c2 \# M! ~
  12. *
    + {, A( `+ e: l- [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( a- d. p% T# [6 M( e7 C8 J
  14. *2 o- @' x/ S, D& C
  15. * This program is free software; you can redistribute it and/or5 @6 m; t% S# w' X$ Y6 p8 R
  16. * modify it under the terms of the GNU General Public License as
      `/ h3 @6 D& {6 O4 P
  17. * published by the Free Software Foundation version 2." I: X: x/ C; Y$ O3 k7 \6 ~* e$ ?
  18. */ Z1 y' t+ ^, m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; U0 R/ Q; {0 I2 I- ?5 `
  20. * kind, whether express or implied; without even the implied warranty
    0 f, i. \: V. V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' t9 S. \6 e8 _: M  r, s+ Y
  22. * GNU General Public License for more details.
    " V: W4 P+ P% v& l9 R
  23. */
    0 U& T! P( m; o+ j* N/ M

  24. 9 V' g! G) P" ?; x9 B
  25. #include <linux/module.h>5 h3 Q& B3 P/ O% Z9 x7 w& Y
  26. #include <linux/init.h>
    , t0 w, X- f2 g6 r8 W. W
  27. #include <linux/errno.h>
    : \7 l/ V3 a, Z! v
  28. #include <linux/types.h>8 C' p6 v4 R; Z# c; X- ]) U
  29. #include <linux/interrupt.h>& z! o/ t- `' D* ?+ @4 b; e3 X
  30. #include <asm/io.h>, l9 j1 ~5 I" S; y
  31. #include <linux/moduleparam.h>
    0 z( P$ h; O4 h, Q/ u
  32. #include <linux/sysctl.h>* s/ I& ~) k: @0 w3 K6 c0 ~
  33. #include <linux/mm.h>. W( \; k7 E' K4 L5 a  L# }- S! u, _
  34. #include <linux/dma-mapping.h>
    1 I! X+ B3 _3 O- |+ C/ M! y

  35. 3 Z+ C4 d/ C7 o
  36. #include <mach/memory.h>
    4 w3 n4 y- Y; X8 s  E. r0 K
  37. #include <mach/hardware.h>
    3 ^6 Y, W+ b+ z. o% {
  38. #include <mach/irqs.h>* G! \" ]: f5 }% L, c
  39. #include <asm/hardware/edma.h>
    7 q+ d0 G: x6 I9 d* X/ J

  40. 4 f0 J5 P9 }' C  w" o
  41. #undef EDMA3_DEBUG0 J* w7 J& {/ d
  42. /*#define EDMA3_DEBUG*/
    & ]7 [* W6 @. @/ H  u

  43. 4 G7 c9 Z' ]+ d( l; p
  44. #ifdef EDMA3_DEBUG/ ]8 O5 _( L$ x1 [! F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . f: z( D+ t, o4 p7 V  a4 O$ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , n! T7 L0 w0 S: l4 E  m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 H0 J, [- s! s% `7 }
  48. #else
    3 T1 S" V  _. i& @: ~& [" G- L
  49. #define DMA_PRINTK( x... )
    ; R; V9 G0 Q- A" D& A! H2 J
  50. #define DMA_FN_IN
    , v2 J, L- a: h7 j6 w6 a
  51. #define DMA_FN_OUT$ l  j2 _/ V2 ~* ]  o
  52. #endif
      r# M2 H" D! f+ N3 g! n: ~

  53. * Y3 g) y& U7 ^: ]: Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): p  T/ c. h' f; t
  55. #define STATIC_SHIFT                34 i. e$ c7 v% x) `. I! D
  56. #define TCINTEN_SHIFT               208 H& A. }0 N- L$ ?2 b# K# U
  57. #define ITCINTEN_SHIFT              21
    6 x7 J0 Y% [" \2 c1 m4 D
  58. #define TCCHEN_SHIFT                22. |7 ^% U5 Y5 P2 o/ ?
  59. #define ITCCHEN_SHIFT               23
    ' y+ i2 e2 A# W6 l) W/ c3 l2 J6 s

  60. ' K, Y. P2 r7 G; ]0 Z! j. q
  61. static volatile int irqraised1 = 0;
    $ {! L, F: f' l7 U  b/ K0 ^
  62. static volatile int irqraised2 = 0;
    7 v2 M. |0 b$ W7 M$ F

  63. 3 H; J. V, t& f1 R$ I' H5 v! b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 W7 |6 e0 x$ _- C. U5 Y5 Q2 c' }# r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ K: E' |7 J) y2 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) M+ e+ R7 S. N4 z" X3 Y- r
  67. , k' }  d6 z* I2 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ' f9 [) z9 L' A% q0 x' ^' O
  69. dma_addr_t dmaphyssrc2 = 0;, f' t9 f5 o! b: J  s9 V6 N
  70. dma_addr_t dmaphysdest1 = 0;8 B+ i& o/ q) C. J6 `! E7 g# Z
  71. dma_addr_t dmaphysdest2 = 0;
    . L6 W: `* X% u2 g: k7 H

  72. % P: a$ ^# U/ H6 g3 z
  73. char *dmabufsrc1 = NULL;
    0 Y! a: {5 t( C  R* i
  74. char *dmabufsrc2 = NULL;
    , L1 ]( k9 C( P. U8 ]$ \7 k% I
  75. char *dmabufdest1 = NULL;
    1 V- ]1 S, D$ L- g7 g3 w: A
  76. char *dmabufdest2 = NULL;
    - `& b3 K. \" e! y1 m

  77. $ {) ]5 |# `  e$ T+ Q
  78. static int acnt = 512;
    , q3 F7 Z+ M. e7 I6 ^, [/ T
  79. static int bcnt = 8;$ k: M0 Q$ K9 ]$ t
  80. static int ccnt = 8;
    # Z! m; s# t' I6 d$ N

  81. * z4 n5 [4 i. Z7 u4 t
  82. module_param(acnt, int, S_IRUGO);  l' q( ~3 j# N- K
  83. module_param(bcnt, int, S_IRUGO);3 R# J  u) N4 l& X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: G* v% v0 }2 g  x# K! S

1 \0 C. n3 I0 B' E7 X( [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 _" q- k# P; c( parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 p8 x( M7 A9 N: ^' Q6 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Y' D8 V1 w- K% F$ `1 O/ I
6 o* Q3 D. O" m
/ q; B* N( A) I$ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 22:59 , Processed in 0.038829 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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