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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! U5 R2 g3 G/ m. O
  1. [code]EDMA sample test application
    # a$ E. v, w. Z7 \- i' P3 y" D8 [
  2. /*1 i& a3 l: J% u4 @0 N
  3. * edma_test.c
    2 O/ z2 ?/ s7 I2 m+ ~
  4. *
    0 `4 T, l. y/ N/ {4 B; l. T
  5. * brief  EDMA3 Test Application( j/ i; s, ~7 w, d0 v
  6. *
    6 G- Z" a* N8 D5 L9 _+ |4 A
  7. *   This file contains EDMA3 Test code.
    ! p! d& l% V3 N/ d! Z' w# Q' A9 {
  8. *
    ! f# K) m, t7 v) K+ t( V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) U1 z0 ~* X% z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. V, o/ ^& G( _/ U5 d
  11. *         TO CHANGE.
    4 P+ \4 ?* w1 }6 \" f
  12. *9 x# b& Y$ R" |8 `3 @, `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! W0 s; `3 ~$ B% N& U3 s
  14. *' ?* E# ^; E$ x) n0 F1 Q
  15. * This program is free software; you can redistribute it and/or1 y4 p( d5 g  v- l- c
  16. * modify it under the terms of the GNU General Public License as9 J: o$ l! H) U2 G# N# W
  17. * published by the Free Software Foundation version 2.
    3 v; y* T+ ~+ H. o8 s+ ?) h
  18. *
    ! D  T5 r3 ]6 ?/ _& v) L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! N# J  f  D3 H! w
  20. * kind, whether express or implied; without even the implied warranty
    6 E7 m& C- F# f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) X2 [) G9 U& F( z
  22. * GNU General Public License for more details.7 z3 s9 }- [- ]" l( J* }' e/ z
  23. */
    2 t- W. b1 C, l8 C/ v/ V8 `

  24. 2 m8 W% E8 {4 e5 b7 V& G
  25. #include <linux/module.h>) Q) L7 N% ?8 w0 E
  26. #include <linux/init.h>! P4 J+ j- u+ n  }
  27. #include <linux/errno.h>
    0 k! U! D( F+ f# v! r( E
  28. #include <linux/types.h># J6 D7 |3 ]& s6 B9 Y
  29. #include <linux/interrupt.h>
    ; w; G. G+ C1 e3 i3 u
  30. #include <asm/io.h># _; H" Y6 Z# \9 G* Y
  31. #include <linux/moduleparam.h>& |! s4 N! r, t1 q# H# Z
  32. #include <linux/sysctl.h>
    / Z9 I4 p$ v) T+ U
  33. #include <linux/mm.h>/ W& D2 z$ w( m1 U+ {: x
  34. #include <linux/dma-mapping.h>
      p) ?* M7 Y, D) @+ k

  35. % [2 Z/ j0 W& f# E/ @2 N
  36. #include <mach/memory.h>0 S$ `; K( |7 u; S
  37. #include <mach/hardware.h>
    4 }8 R4 ?1 \5 m5 M- p4 M
  38. #include <mach/irqs.h>
    - ?( \! M$ F1 |: q, j) ]
  39. #include <asm/hardware/edma.h>
    6 [3 U+ N% B( w1 F% ^0 m
  40. 8 u3 I* w) q  a6 B" m
  41. #undef EDMA3_DEBUG
    ( t( T; q- |( d/ J( [3 u
  42. /*#define EDMA3_DEBUG*/
    ; F/ \& ?  ~! r+ N/ }# G
  43. ; A& T0 N* X/ }2 W
  44. #ifdef EDMA3_DEBUG
    % j/ k9 u/ r% L# t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& m' Q/ X7 D; i* [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # V% P/ p. t; ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I( h% s+ B0 w. [3 s. L' F! I+ F
  48. #else
    * X9 J- u/ b2 h1 Y2 g: ^7 [
  49. #define DMA_PRINTK( x... )1 u4 l3 ?8 l, G8 M4 W1 P1 ^
  50. #define DMA_FN_IN2 C6 C% C) r) b
  51. #define DMA_FN_OUT2 U# k* x5 Q' x' f
  52. #endif& r; K: p. s2 q# V: j1 m; \. o, x& Y

  53. 8 \& `$ x2 g1 ?6 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( r1 V1 C- C$ r& n. h5 F- C; y
  55. #define STATIC_SHIFT                3
    , l; F8 W. H: v- J" q4 i1 B6 T
  56. #define TCINTEN_SHIFT               20- u  A" [4 W# H. }9 q
  57. #define ITCINTEN_SHIFT              21
    7 D4 n' w( _6 a8 M
  58. #define TCCHEN_SHIFT                22
    : w& G# l+ B& [( Q; _5 C; w
  59. #define ITCCHEN_SHIFT               23+ P) U2 E! `/ q2 r

  60. ) A" D% W, m7 W' \% ^7 w
  61. static volatile int irqraised1 = 0;
    7 C) `( \9 B* a, R
  62. static volatile int irqraised2 = 0;' k8 c3 y- P5 m  l2 M5 \0 O
  63. - q: Q; r/ L  U; c3 v/ J6 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z$ k8 u0 Q; J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v/ A, _+ E6 c! {( n+ D0 h! l1 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " A, |/ b  t# p. t8 s$ i9 ~
  67. ! a. [. U- @2 ?( R- T9 v
  68. dma_addr_t dmaphyssrc1 = 0;
    ; N  N- E/ u" P- u, ^2 e
  69. dma_addr_t dmaphyssrc2 = 0;/ j7 {& r) ~$ s9 {- a' E+ Z
  70. dma_addr_t dmaphysdest1 = 0;: H, ^& a( L( y* E/ d$ M
  71. dma_addr_t dmaphysdest2 = 0;$ s  i8 Q6 N8 R- g
  72. 7 ~) |9 G" v/ h# t- ?
  73. char *dmabufsrc1 = NULL;
    8 c$ g: n* h; I( X- Z: ]7 R$ }
  74. char *dmabufsrc2 = NULL;
    " x. _5 }( U4 Q/ Z# |# N$ ~
  75. char *dmabufdest1 = NULL;
    9 V' i# W" ~' `  m2 K: n% H
  76. char *dmabufdest2 = NULL;
    7 }# Q% {4 M7 ]. F* G

  77. 0 Q/ M1 A, y: H* C( e
  78. static int acnt = 512;+ M4 k* R/ i, X3 j# i( ?
  79. static int bcnt = 8;
    $ A' K& t, z# O3 ^0 i
  80. static int ccnt = 8;
    1 C2 n7 n: }0 R2 L; i
  81. 6 Y" [( ~2 F! F) ]1 B
  82. module_param(acnt, int, S_IRUGO);
    - d8 Y7 l: I$ u* Y: m, G- m& h! G
  83. module_param(bcnt, int, S_IRUGO);! o2 B% V- S; P8 }* D$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^) ?, K  U/ w/ I) q. t8 @; t1 }% \: c5 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ m" X0 o2 c0 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~- w& A) [+ m4 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( d* G, i0 w+ }) L
$ i1 u8 b: m0 I4 @6 {6 k5 I+ U) z8 S# Z3 Q! P7 p; y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 13:12 , Processed in 0.042756 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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