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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 f/ L9 @5 A' M: R7 ]( ^) g/ C
  1. [code]EDMA sample test application
    0 {% |+ @: G2 o, T
  2. /** L' U% ]! `0 ^  M8 G7 ]8 h! ?
  3. * edma_test.c8 J' l- m4 W& l! E8 v6 t
  4. *
    3 n. @3 f& e4 S
  5. * brief  EDMA3 Test Application
    - \) i( i8 [' [
  6. *7 A6 t1 x: J) T: H4 s' }
  7. *   This file contains EDMA3 Test code.9 _& ~! }) R) k1 t  H- I
  8. *
    4 r' c% K" {' Y: D( V+ F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 L3 K  |' C' U0 a  a% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " z# [3 ?( q0 I7 g& S. _" m+ H8 `
  11. *         TO CHANGE.; X7 ~" [1 L1 g
  12. *2 Q: R1 \, t! Q! E% W3 W2 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % i( @0 h' i* G  ?$ ?
  14. *
    & }8 Z0 z: Y  F+ F2 P( Z
  15. * This program is free software; you can redistribute it and/or
    5 V- W4 V( F3 N
  16. * modify it under the terms of the GNU General Public License as# G: i' o3 X2 E+ D
  17. * published by the Free Software Foundation version 2.
    / T0 e. q* W$ h* s/ B+ g. R$ F
  18. *6 m( W- |( J3 D$ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) \6 o* V2 |& S# V' o+ _
  20. * kind, whether express or implied; without even the implied warranty
    . Z* P" j0 J2 V% J' g( L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : x  Q' M: Q1 }: x# H* U
  22. * GNU General Public License for more details.$ Y$ O9 j' }0 c
  23. */
    , @/ b) i/ a$ R1 i4 R& _! r; ^4 ~
  24. % n; m# u2 ]0 Z& E0 O5 t' d
  25. #include <linux/module.h>
    - R( B  i* C$ Q
  26. #include <linux/init.h>- L9 y0 M) }) i1 a/ C$ \7 O
  27. #include <linux/errno.h>9 j4 Z1 j0 V) J) d' e4 i% R
  28. #include <linux/types.h>
    1 j, ^* E, C5 X3 k1 l: b
  29. #include <linux/interrupt.h>
    - L, R! \* b/ g% @9 u8 U& ^
  30. #include <asm/io.h>
    8 L' u- [3 p( r3 O
  31. #include <linux/moduleparam.h>& u- D& w/ T5 d5 y- q
  32. #include <linux/sysctl.h>
    ) I0 t0 a; V/ e/ y" I
  33. #include <linux/mm.h>" T6 q0 [! c4 S+ T4 w
  34. #include <linux/dma-mapping.h>" d& E/ q! ^1 {& \8 t5 {$ f! _  M

  35. ) a& s  Z: t, A/ f# f, h3 o+ i5 U
  36. #include <mach/memory.h>) u2 h/ _; }# y3 J: f$ u, M- e
  37. #include <mach/hardware.h>  z' @. s- f, v1 r# c8 B5 a: b0 v
  38. #include <mach/irqs.h>
    0 b. a" b! h! W! h. p7 Y
  39. #include <asm/hardware/edma.h>
      v) [2 n. q: q- D1 |
  40. 3 i: }, C3 u  F) [5 F, D# r
  41. #undef EDMA3_DEBUG
    5 O1 y; H, ^! E# C$ l
  42. /*#define EDMA3_DEBUG*/  B% g" d- R* Q6 H
  43. ( r4 W+ \8 m: i% S) B
  44. #ifdef EDMA3_DEBUG7 B( Q4 Y" c7 M& \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# \2 k, l4 O6 L4 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 H( o! L  a0 ~; @2 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 h. N0 W7 E' Y. b9 @7 c
  48. #else; m$ E0 r" J  m/ Y1 |; a! Z1 T
  49. #define DMA_PRINTK( x... )
    9 ?& Z9 p$ w0 `' b3 J
  50. #define DMA_FN_IN2 C7 ]. L" I& ~5 M4 T0 Z1 v- r
  51. #define DMA_FN_OUT% U4 V* @( W( M9 M& Z7 w2 T) b
  52. #endif. v( d, d" _, \6 a# _
  53. " r5 j$ U1 |! p0 _8 p4 c4 C: M2 @8 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); P  g5 N1 X# s/ W
  55. #define STATIC_SHIFT                3
    4 o* B* |$ p5 q" e# _* [, }
  56. #define TCINTEN_SHIFT               20& Q, F$ c2 T0 M) K  U. U4 _9 b5 g6 @
  57. #define ITCINTEN_SHIFT              21
    3 z+ c; V% a" l( l. n; n
  58. #define TCCHEN_SHIFT                22$ C+ s! z8 Q2 U9 I
  59. #define ITCCHEN_SHIFT               23" |( q" Q, A: v+ {* v9 U

  60. ' e/ G& O# o0 E- X4 d/ Y. J
  61. static volatile int irqraised1 = 0;' b8 Y- l3 ~0 T9 H
  62. static volatile int irqraised2 = 0;
    9 V: O" ^- `0 V+ D, {6 x4 J

  63. . b3 Z0 f: b( \) U, e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( r: f/ v- o# J1 A" J. }/ g: J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G) X+ o3 ?% B; ?! k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c+ R4 B2 c. S
  67. ! V" Q7 x  v% l3 j! s* f9 j
  68. dma_addr_t dmaphyssrc1 = 0;
    5 M4 s  D' J. B+ Q9 `0 q
  69. dma_addr_t dmaphyssrc2 = 0;
    - F  n% j- K* Y" O9 z7 \
  70. dma_addr_t dmaphysdest1 = 0;
    & N- Q# F7 v0 ]! S& L
  71. dma_addr_t dmaphysdest2 = 0;
    ) C$ E% ~8 g; f3 }# }7 b
  72. ) C4 [6 c! _* t, G. a
  73. char *dmabufsrc1 = NULL;
    $ F6 M9 G' e: X$ Z  ?1 c
  74. char *dmabufsrc2 = NULL;
    . m7 d' m; e; ]2 Y
  75. char *dmabufdest1 = NULL;% e$ c1 `) y8 Q" ~) w
  76. char *dmabufdest2 = NULL;* Q/ _' M0 J: S1 L+ @+ r6 V) C

  77. & S  z' a1 C" N6 j6 [. e5 R" \4 e
  78. static int acnt = 512;
    1 i5 x$ C" V( q' O
  79. static int bcnt = 8;5 O, D- y) k* ?
  80. static int ccnt = 8;& Q' Y( J1 |* e( i. h/ `

  81. 7 V$ ?% O1 I. U
  82. module_param(acnt, int, S_IRUGO);
    : q" p0 z) [0 L1 t- n% h
  83. module_param(bcnt, int, S_IRUGO);, l8 l0 X+ Q- F% x4 f4 k  G# r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! L1 R  M7 M7 Z, i+ v% D3 h3 }
6 z* \; v8 x3 t; b- k  k8 Q$ Q! J9 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: D( K3 `1 Z9 F- p7 a+ R7 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& M0 ~, n6 f3 R% |+ _/ Q4 \! u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( P8 `8 z7 w1 O9 @* }" A; Y

/ K" L1 ]1 i9 s8 W
4 L* }( v% {) Z- Z$ `! S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 05:44 , Processed in 0.043802 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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