OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 P& C9 m( a+ k; d
  1. [code]EDMA sample test application
    3 v/ P- e2 q* ]/ s
  2. /*
    $ e% `, @3 i( J. O: z7 N
  3. * edma_test.c
    - R: Y  E3 @1 ~$ V  Z1 z4 X
  4. *
    : v' Y! S; m1 t5 Q/ f
  5. * brief  EDMA3 Test Application1 L: ^1 @- _# }3 g1 J, c
  6. *
    % a0 \( s% k# @' s) F. ?
  7. *   This file contains EDMA3 Test code.
    ; O9 _8 y$ k* J! v! p2 C
  8. *% g4 J6 k' Y) p; E" J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 F; }. I4 X1 J% b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: @" H/ v' Y* Z. C( g0 G  y9 D
  11. *         TO CHANGE.
    0 Y4 \0 p$ g( x  i' ]* s; C) r) b
  12. *% p4 ?6 }( I% N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# R9 t, e- J4 D- s0 ~
  14. *% W& C& D/ ^- z" K/ h5 E" v
  15. * This program is free software; you can redistribute it and/or
    5 x8 z$ {0 O6 l; {
  16. * modify it under the terms of the GNU General Public License as
    ) ~# I0 M9 J8 [9 U6 A& W
  17. * published by the Free Software Foundation version 2.
    4 L2 E+ t: m; |  t: D& S/ I0 n
  18. *$ g1 b2 B2 z1 ?: w9 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Q1 N, U2 X1 M6 K9 |- I8 A  l  s: ?
  20. * kind, whether express or implied; without even the implied warranty  }/ k: `# k3 }# Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 Y8 L+ U8 V7 L. y
  22. * GNU General Public License for more details.! h& C8 J" j( K( q* f
  23. */
    , z: C/ \/ w. Q# n( T0 [5 g% s. w

  24. 3 d+ x4 e) Z6 O: n* B! C0 L/ A
  25. #include <linux/module.h>3 O# y9 V& m7 Q3 A! n" |
  26. #include <linux/init.h>1 G! C0 P& c' O5 j$ [
  27. #include <linux/errno.h>
    ) P  y" {  o3 @4 V. ^) C
  28. #include <linux/types.h>( G; Q. c+ K% l9 f8 F
  29. #include <linux/interrupt.h>
    6 O1 P, J1 i. Q- ^
  30. #include <asm/io.h>
    - S9 U* e* u' A8 s
  31. #include <linux/moduleparam.h>- U# z& I, m5 C$ g5 r* C! Z
  32. #include <linux/sysctl.h>& G7 ~: U6 s; H6 b# z  I) D
  33. #include <linux/mm.h>1 v$ V* W4 B7 |0 Y1 e2 F
  34. #include <linux/dma-mapping.h>& P5 w$ N  r9 F: v) A
  35. 6 T" F  D, Y% m
  36. #include <mach/memory.h>
    0 H+ g8 B6 z& T' a7 b$ v  P; F
  37. #include <mach/hardware.h>- D9 A0 m3 J+ B7 _2 l
  38. #include <mach/irqs.h>: p3 i/ W& ]( p' j/ e
  39. #include <asm/hardware/edma.h>
    5 J" S4 F$ i0 F1 @: _4 H! B

  40. $ L8 u5 f: d3 F# R9 f% f# I
  41. #undef EDMA3_DEBUG
    3 I1 y' T/ x) o$ \; G6 o
  42. /*#define EDMA3_DEBUG*/6 j* G- \9 b% A1 B/ A% w) Q# q2 e- |$ M

  43. 6 }: d8 U( d) _: R+ d2 E
  44. #ifdef EDMA3_DEBUG8 M, o$ S' `  u: l/ M: U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( M( `% J: g, F$ h& o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      x) m% @1 C1 u8 K' C0 P" Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & ^% T' D# W  W6 }. D; n) [) U
  48. #else
    3 ]; r. {8 g) {2 v: |
  49. #define DMA_PRINTK( x... )
    7 x6 j) U8 \9 ^& |5 i9 T4 G  S
  50. #define DMA_FN_IN1 O6 |( y& @5 f3 p" @( o+ b3 W8 B
  51. #define DMA_FN_OUT
    / d2 s) s% j' S* R! T
  52. #endif0 }: R( v( V' P% z( a
  53. 0 |; A; u9 }" w5 \+ [1 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# U% a& b2 `0 R* v! V
  55. #define STATIC_SHIFT                3
    2 }6 n6 C9 O; N  A" ^8 k6 h+ u
  56. #define TCINTEN_SHIFT               20
    & {! w8 Q' ]1 D) x9 `
  57. #define ITCINTEN_SHIFT              21
    2 H5 S  m! t# W" l  j3 f
  58. #define TCCHEN_SHIFT                22
    ' ^. }  c( I4 U9 c
  59. #define ITCCHEN_SHIFT               23
    & s3 Z* q1 L& B( l

  60. 9 ~2 S3 r% Z, J, o+ L
  61. static volatile int irqraised1 = 0;' N* w; I1 k2 p3 d
  62. static volatile int irqraised2 = 0;4 [* [  q  B7 a$ y( v* e
  63. / k2 M7 c- N6 |" B# \; C, u* I, S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q. \' g, E6 C4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- y* {4 U$ W4 v, c/ G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / n/ f) ^( T9 L' T6 _

  67. 0 s, Y) z6 \. O7 c/ e/ z
  68. dma_addr_t dmaphyssrc1 = 0;
    5 i6 J+ Z  z2 f- i- @& f/ w/ I
  69. dma_addr_t dmaphyssrc2 = 0;( T* \9 z1 u( L" x, {
  70. dma_addr_t dmaphysdest1 = 0;! r" {2 z5 H- b! C! R( I) ~0 _
  71. dma_addr_t dmaphysdest2 = 0;
    ( e" h! p% b7 S+ q. K

  72. 2 N( @) j2 ^: ~8 ?3 I, U* c
  73. char *dmabufsrc1 = NULL;
    : @6 G! I! G" O- R4 L  Q+ X9 g
  74. char *dmabufsrc2 = NULL;# C8 n& C7 z+ w) M& _- K/ y
  75. char *dmabufdest1 = NULL;
    ' _& b5 }3 J- M' q" `- y4 S
  76. char *dmabufdest2 = NULL;
    + G% L# n! T0 t- ]

  77. ) S5 ?; o* |8 C& M2 J# I
  78. static int acnt = 512;( v6 e) Z5 w4 M9 L
  79. static int bcnt = 8;; ]  a6 S% j! _: p1 X
  80. static int ccnt = 8;% j  b; N+ M" P
  81. 1 e7 ~- n1 d& f" j
  82. module_param(acnt, int, S_IRUGO);: r6 r+ F' h7 v
  83. module_param(bcnt, int, S_IRUGO);
    & p$ K7 c3 _3 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 [; v9 M  `" H: r9 f7 _
& x2 {0 l# G: D! f  X3 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 O# i2 k" F' ^5 |# c: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 W, c$ q4 t4 d" W* F6 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; e7 R2 }1 C) L
+ Y4 e4 ~* [6 J6 a4 m) V" p& t9 m
. [- m3 H. ]! z" o* r( H  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 08:14 , Processed in 0.043427 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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