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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; d7 v+ G9 @/ t: C' c4 ^8 R
  1. [code]EDMA sample test application
    * Y( z$ `- e* J$ B* Y; T& m
  2. /*
    / L5 x3 q+ Z, o5 Z! c
  3. * edma_test.c" L* U# R. D9 z  R( Q2 Z7 d
  4. *" N5 W/ Q8 y  F5 ^$ [
  5. * brief  EDMA3 Test Application+ p6 Z6 W  F$ V: q! K# C# C4 {" [+ v
  6. *
    ) @- o, {# n5 O8 y8 p& H
  7. *   This file contains EDMA3 Test code.
    " A  b8 O5 w7 N1 {
  8. *
    9 g- C: U2 m+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 B( C$ T$ K2 x+ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% [& ?/ n5 B9 U$ p2 }/ U# w% h' N
  11. *         TO CHANGE.
    - m( s/ b! R. K: G
  12. *
    - [8 Y" F+ `9 u! G- i7 z, A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 m! m, x7 X+ `" p+ _! Y
  14. *) G$ I& C0 t# I
  15. * This program is free software; you can redistribute it and/or
    7 |. @1 L* {+ m: Z: ?1 I$ }# }$ T
  16. * modify it under the terms of the GNU General Public License as- G: k4 V& {' ]4 X+ `9 D6 b
  17. * published by the Free Software Foundation version 2.' i7 G4 k4 R5 I+ v  F8 [9 l
  18. *
    ' j% O9 j% j7 a9 U  T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( n) U  X4 O. O7 E
  20. * kind, whether express or implied; without even the implied warranty2 g2 S3 i- c6 ^' p) l8 ?4 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 Y( z. B5 g+ ~9 f) l$ A
  22. * GNU General Public License for more details.
    ' y, [. t" K1 ]& T- Q  V, J+ k8 Q, x
  23. */
    $ p6 N7 N) `& D6 U# L: R6 H

  24. & C5 N" s' C0 ?0 ?# f
  25. #include <linux/module.h>$ _1 C( u* z9 P' B
  26. #include <linux/init.h>) ~5 p' l  [8 V
  27. #include <linux/errno.h>9 x$ f, e& Q/ Q/ n
  28. #include <linux/types.h>
    * r4 g5 }' }' g7 Y: Y1 ^) y6 W
  29. #include <linux/interrupt.h>
    , r: ?, q3 i: @- i: M/ X
  30. #include <asm/io.h>0 m* s" _. w% B1 X" f/ ]
  31. #include <linux/moduleparam.h>2 k5 g& \6 R$ u5 K! h
  32. #include <linux/sysctl.h>
    7 V: O) C( J( Q8 Z/ \6 ^
  33. #include <linux/mm.h>5 l7 d8 r) h) Z# z& t4 u& G; Y# g! d" U
  34. #include <linux/dma-mapping.h>* d; k$ v( Q" S/ t6 Y
  35. * f+ v+ u$ G: ^
  36. #include <mach/memory.h>! d3 u* F- N9 F2 ^9 W* _8 v+ H
  37. #include <mach/hardware.h>
    1 m2 _1 P; f$ B: U2 f
  38. #include <mach/irqs.h>2 K$ Y8 f9 _6 n* ~
  39. #include <asm/hardware/edma.h>* a  d; k* r  z" i; J; n2 L
  40. . `# Z2 Q) G6 M% b0 I
  41. #undef EDMA3_DEBUG
    8 i% O, _- ]; c* k; w1 {
  42. /*#define EDMA3_DEBUG*/
    : G6 u0 B& M% h/ t) Z' f

  43. 5 B5 J, L/ q* I% R
  44. #ifdef EDMA3_DEBUG7 c* V5 I2 L0 J8 @- N6 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 u( v8 ?3 G+ s8 V6 x# ^  Q6 j3 n/ x+ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _( ^- F6 l+ C+ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % y+ n( r9 P8 T
  48. #else/ S7 e# d( a4 _5 `/ a! D
  49. #define DMA_PRINTK( x... )- J3 k9 v  y+ k! s" p+ ?  R
  50. #define DMA_FN_IN: `; l" W% S) Z- ]7 @: M
  51. #define DMA_FN_OUT
    ( B) \( z" o" X( r. Z
  52. #endif, Q& V8 y) o! o  F7 ~% i; C
  53. ( l' G( r! ^' [' i# u) w. I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), N# T0 O, K7 B6 ]- \
  55. #define STATIC_SHIFT                3; `$ G% E8 \$ k6 t) v4 @& ?! C
  56. #define TCINTEN_SHIFT               20+ X- m$ I3 S9 H9 {" N$ _+ {
  57. #define ITCINTEN_SHIFT              21
    . q! C/ w% u% n4 m
  58. #define TCCHEN_SHIFT                226 v6 s+ |1 S+ _# o" l
  59. #define ITCCHEN_SHIFT               23
    " p/ h1 Z9 g3 U$ ~6 R. C. [* A, R
  60. ) T4 f2 U( g2 |8 m: `
  61. static volatile int irqraised1 = 0;- ^' T9 K1 D) w2 q. M3 `# P7 x& V3 U/ i
  62. static volatile int irqraised2 = 0;& W' X8 h1 D# m1 r
  63. ; S; k" S1 a/ ~, ~/ n* }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 r0 N* N5 ?# h, a2 C( F) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J; b$ r3 w; s" c) ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% H, q4 T& m. h# y$ r" X* X
  67.   k9 P2 H1 _3 Y/ P7 q
  68. dma_addr_t dmaphyssrc1 = 0;
    1 m0 t6 O2 s  ?* A" h  x2 [9 [
  69. dma_addr_t dmaphyssrc2 = 0;# M0 ?) f1 L* g6 V- L& s: A  n
  70. dma_addr_t dmaphysdest1 = 0;
    ) P1 c! m; q/ H, W
  71. dma_addr_t dmaphysdest2 = 0;
    ! ^7 h8 d2 A! R) |9 E1 n* c9 g
  72. , ?" o8 r7 O# ?+ y( c
  73. char *dmabufsrc1 = NULL;
    8 \& P4 P7 V! Y( Q
  74. char *dmabufsrc2 = NULL;; x- y( J: k" {; B/ P) X- k. x
  75. char *dmabufdest1 = NULL;
    % l! P" G) I/ R; L& ~
  76. char *dmabufdest2 = NULL;1 s- J- \7 L5 p; x, K

  77. # u* G. t) i% F: p2 E
  78. static int acnt = 512;' [5 }: k3 l" s' L  G5 A! C- g/ @
  79. static int bcnt = 8;( Q5 y: P8 h2 c0 O- s  [0 f
  80. static int ccnt = 8;9 `5 b1 B8 L5 `/ ?! p- z  k/ r
  81. ) U9 U4 |6 t  J6 N' g
  82. module_param(acnt, int, S_IRUGO);
    / v+ e. l% u' W  C. Y; Q! Y; ^
  83. module_param(bcnt, int, S_IRUGO);; X. }6 N- {7 c& a1 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) d) w3 T! e: D9 l
: O' R3 T$ H" C9 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 f8 ?7 l# [( j7 W3 @( b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ~8 c  k" e( n0 @& {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 P# S8 x) y9 @* l& h
; X3 f; _6 S. k/ r

' ^) W$ e- W" O* {( z0 [! c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 10:06 , Processed in 0.043137 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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