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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 N; \2 W1 d0 i% X, `7 \
  1. [code]EDMA sample test application
    ' e5 L) J4 U3 Q$ [5 T# z  F0 m
  2. /*8 t- U; l: s- y
  3. * edma_test.c' K& A/ J5 U0 x# z
  4. *2 U6 V, G& h+ H0 o7 w* R* q
  5. * brief  EDMA3 Test Application' m* \% I: i; z0 Z1 b  F+ [" ~
  6. *
    $ G0 d, X5 X/ a# q$ p2 H, e. V, G
  7. *   This file contains EDMA3 Test code.
    6 `% E" B7 e( V
  8. *
    9 w+ K# _( Y7 Y8 D8 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ s8 U/ a2 s+ Q5 T0 ^! ]0 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' @" d' x4 u. y$ M- d4 |
  11. *         TO CHANGE.
    / O" H6 |5 X+ W1 V8 L0 }. J
  12. *& N3 a$ u4 ^. H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' t2 m3 ^. n/ l* l' x" ^1 l- W# M4 p
  14. *1 k, P. F- S; ?5 }
  15. * This program is free software; you can redistribute it and/or/ J3 {0 [/ Y  T! Z
  16. * modify it under the terms of the GNU General Public License as
    ' b4 p. ~0 I) {' o5 M9 M& ~
  17. * published by the Free Software Foundation version 2.
    8 S1 f" q& F. q1 i4 O& L- s
  18. *
    ! U. \* E8 N, r# `& m& Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% W7 x8 D1 t2 H# O' J; S
  20. * kind, whether express or implied; without even the implied warranty
    7 \" Q* I, b+ n9 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) L& u0 {8 u! a: X
  22. * GNU General Public License for more details.3 b, E4 c# l# W0 a$ H. Y7 s
  23. */
    . B! F) F$ S5 C

  24. , @* ^7 B! m8 A' j" R( f
  25. #include <linux/module.h>! v) f% L' D* Z4 z' {2 ^
  26. #include <linux/init.h>+ {1 ~' f6 N  N( Q( j' z
  27. #include <linux/errno.h>. _2 S7 d; N# D0 c
  28. #include <linux/types.h>
    * f* L! n) h) K; }5 n( |
  29. #include <linux/interrupt.h>- g) S4 o5 i9 [" K" {* Q
  30. #include <asm/io.h>0 x! H* p4 w7 L
  31. #include <linux/moduleparam.h>
      Y2 S. B& z5 y( A# a% e
  32. #include <linux/sysctl.h>4 R- u7 W  J+ I* H% K* X& G" o
  33. #include <linux/mm.h>
    2 l! M8 x7 m  J: D% z0 q
  34. #include <linux/dma-mapping.h>
    1 J  C2 Q" r' K* v" K* O0 ~" O

  35. " `; U2 S. @( h) s
  36. #include <mach/memory.h>3 x/ _0 A" I! u' l2 `, ?
  37. #include <mach/hardware.h>
    2 \# F: @/ q- d' ~7 I0 ]
  38. #include <mach/irqs.h>- h/ e9 s" u7 w1 V8 q  Y
  39. #include <asm/hardware/edma.h>
    , V. ^2 h: d' @" I$ Z) R2 I* T7 `
  40. 9 K$ h9 w. ^' H% ~/ J3 v4 ?
  41. #undef EDMA3_DEBUG
    . u, V& \0 f$ m/ \4 \6 Y5 q
  42. /*#define EDMA3_DEBUG*/5 ^$ U( C4 [1 G9 K3 K

  43. 5 Y0 a7 Y6 W1 O4 Q% W/ l
  44. #ifdef EDMA3_DEBUG
    " a# g. J( Y- H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Y$ M; Y0 m2 {1 E# h  t3 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 C! J/ {( }3 u  x: S0 w7 V  v- ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - m1 x9 h  \6 k7 \% }: t, I
  48. #else
    3 a6 W$ s5 n* o$ T; f8 x) W7 s
  49. #define DMA_PRINTK( x... )
    7 g, {7 j  s" e# h0 I
  50. #define DMA_FN_IN
    0 v! I$ m+ B5 z2 T- ~
  51. #define DMA_FN_OUT
    6 c# l2 V; U$ Z5 L7 y0 P
  52. #endif3 g9 m( d! I9 J' @8 m% k' Y7 }: T

  53. / c; p4 o8 W2 Z; R* \5 N* g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 n) Q3 j1 F% D: r- x- V( V+ Y3 S
  55. #define STATIC_SHIFT                3
    - S$ u6 l# A8 {
  56. #define TCINTEN_SHIFT               20
    & E* g& g, ?9 T* c( |
  57. #define ITCINTEN_SHIFT              21& r+ D) q& }/ t  c* u- d
  58. #define TCCHEN_SHIFT                22
    3 G5 \8 [' v# f
  59. #define ITCCHEN_SHIFT               233 k: W6 e. H% t* s& R

  60. & G: L- X( @/ x3 N$ p$ P' m; k
  61. static volatile int irqraised1 = 0;
    & Z- e+ d( V% O/ o
  62. static volatile int irqraised2 = 0;6 B4 A. F) W" ]$ V

  63. 6 f" g/ }1 ^; k7 o$ `. j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w, m  A4 h3 A& _3 C' o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d1 ^7 V2 n3 D+ R9 \& Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^# O8 c9 `6 h+ E0 X5 V

  67. % h# Z- }5 L7 b) m  |
  68. dma_addr_t dmaphyssrc1 = 0;- X5 I% a6 L# e4 M
  69. dma_addr_t dmaphyssrc2 = 0;* o1 B0 k. F/ [( }$ ~  W2 Z% Z- ^; o6 i
  70. dma_addr_t dmaphysdest1 = 0;. M4 k8 c" S: D. m; w
  71. dma_addr_t dmaphysdest2 = 0;: Y! N  m7 M" \0 N0 D6 o8 [. I0 I! X( g

  72. " B4 M5 d" Q# o& l
  73. char *dmabufsrc1 = NULL;
    ) v3 E# p3 U: `0 v) t
  74. char *dmabufsrc2 = NULL;# r2 e6 c+ [& z; b) E$ i. I9 J$ ]
  75. char *dmabufdest1 = NULL;; Z0 ~3 ?/ o1 O' ]- E
  76. char *dmabufdest2 = NULL;$ }# R2 [# a; z$ N5 A1 X8 t; T; i

  77. 8 Q' e  v4 l/ s8 @
  78. static int acnt = 512;
    3 K9 ]3 }( u: @; K( r
  79. static int bcnt = 8;6 [7 K5 m& N1 A% |# {$ Y6 X; ~- ~
  80. static int ccnt = 8;
    6 H4 c3 Z! J7 g9 X
  81. . x. E" z( A' y" n4 {: X; L! s
  82. module_param(acnt, int, S_IRUGO);
    - G) d" r# `8 e5 f% n! }* q
  83. module_param(bcnt, int, S_IRUGO);& w) T* L- }4 P% A4 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! W9 F( }5 M  ^  W
& G8 U& N6 Y0 k" A5 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# O( J) X, |6 f5 N8 {  ]1 N6 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ~& Z% U5 P* _$ M7 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* j: l0 N7 e" W+ E. V5 Z+ f' ?
  H  D0 i, p; ?5 E
. |8 T* U9 q$ f1 N' C" ]9 A9 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 08:43 , Processed in 0.040398 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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