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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , o' V$ y8 P& i* k
  1. [code]EDMA sample test application4 m# ~# I4 B+ `; i: U4 t5 C+ q! K
  2. /*0 O4 [( D) Y2 E- {
  3. * edma_test.c
    . @. N  M! b/ h6 r8 b; z
  4. *
    % S( {: ^) N7 t+ M) s6 F
  5. * brief  EDMA3 Test Application
    * n  D  R7 [0 e, G( T3 u+ ?; \
  6. *4 v2 d$ |) }  }3 [1 Q# O% @
  7. *   This file contains EDMA3 Test code.6 z# i0 _$ e/ W0 q, n4 W1 K! e; w
  8. *
    * `( V# E1 Q' `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! O7 t. [# s  f4 Z5 d- `# B5 U% D5 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * z5 g/ V: f) g
  11. *         TO CHANGE.
    ! e# h" @& k3 W" E0 r' E5 W
  12. *7 l& S/ \# N+ {+ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! T9 K) Q. w1 x$ k7 ~7 l7 x3 r6 Q
  14. *0 \5 _% K3 s, E7 p' C$ p& h" N$ E8 I1 L
  15. * This program is free software; you can redistribute it and/or
    ' e, s2 I* g4 ~; t, M) R
  16. * modify it under the terms of the GNU General Public License as
    ' U3 Q* @5 X8 X1 @, K9 L1 _; I% H4 Y
  17. * published by the Free Software Foundation version 2.
    ( P2 f6 z/ T5 i$ W# N$ m6 n2 Z0 [
  18. *
    7 n( Z& ~6 Z# I1 }$ r& t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c) M% g% A+ g. g  }
  20. * kind, whether express or implied; without even the implied warranty
    1 |/ f3 K+ l, z1 m0 x3 U+ f. T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! p9 F( @1 U/ i# f5 s0 a" e6 }1 H/ r
  22. * GNU General Public License for more details.; T% X$ W3 I, Q; s4 R
  23. */
    # U7 P) @4 A2 \2 m7 m. Z2 z& @9 F; E* B
  24. + x6 [' q' r$ [* v2 ]2 v" i2 c2 P
  25. #include <linux/module.h>+ c1 c- N. l& E! I, t' r
  26. #include <linux/init.h>
    : i( P( g% @3 V+ J6 F! h, L
  27. #include <linux/errno.h>- X4 d! H% k' K9 \+ T4 I; k
  28. #include <linux/types.h>6 g: f5 T; _7 Z
  29. #include <linux/interrupt.h>1 K; X( a1 M, n0 ]) w' t
  30. #include <asm/io.h>: s4 L3 f8 F- J# w* p7 h. g& r/ E
  31. #include <linux/moduleparam.h>
    9 V* n7 l8 L  v' W
  32. #include <linux/sysctl.h>! O; E8 U2 z- W2 u. S8 G, P
  33. #include <linux/mm.h>! W" f+ Y# D% h/ K
  34. #include <linux/dma-mapping.h>$ L1 G+ D7 H  V" R! f
  35. 9 n) \$ `7 F3 s8 @$ w1 f
  36. #include <mach/memory.h>
    ( Z( p/ `8 z% H8 ^
  37. #include <mach/hardware.h>3 B; @8 ?( Y9 V, D7 q3 U' c$ A
  38. #include <mach/irqs.h>$ ?3 [2 E0 K$ c4 z( @- S: K
  39. #include <asm/hardware/edma.h>
    , I" U6 g  {8 I- P

  40. ! T5 f( E- e. }7 O& \# ~% \% d& h6 w
  41. #undef EDMA3_DEBUG8 W1 Z/ p0 _3 F9 p, i# m
  42. /*#define EDMA3_DEBUG*/! e$ }5 f' N6 q7 y6 _1 e& u

  43. 7 p  n, r( k! e" O6 {  j2 G
  44. #ifdef EDMA3_DEBUG
    " T+ J3 L  P2 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / Z$ y. n0 Q+ ^/ L9 f" H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + r, h6 Y! g4 J$ N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 m7 \0 O; K3 w+ _8 X
  48. #else
    " \% d6 |; Z* x+ h
  49. #define DMA_PRINTK( x... ). O0 Z9 p2 x) S" Y5 q: ^4 k: d
  50. #define DMA_FN_IN5 @+ [9 m) P7 R6 l* P
  51. #define DMA_FN_OUT9 z9 W: _6 s  W9 w
  52. #endif9 z8 M3 q1 U4 M2 c$ ^9 w( b

  53. 4 n% M4 s+ z8 ?, z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 {' c! o) a6 f9 L" X/ h
  55. #define STATIC_SHIFT                3
    9 ^! T& g) \- W6 ]: h
  56. #define TCINTEN_SHIFT               20. t* a' E! h( z3 Z: J
  57. #define ITCINTEN_SHIFT              21
    ! _5 `# n9 I6 ?
  58. #define TCCHEN_SHIFT                22
    ; w3 ~' a8 D8 ?% S0 i
  59. #define ITCCHEN_SHIFT               23
    3 W: F9 v; n, ]' B" ~& z8 @

  60. + K! Z8 h* i& o5 X
  61. static volatile int irqraised1 = 0;
    2 g% D  [6 [2 x) E, {5 Q. y
  62. static volatile int irqraised2 = 0;
    / U, O; j! m5 C- K( R' R! D

  63. / `: S0 C- j2 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 c7 \5 e* a7 f4 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]! H: S1 @: ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U# X; I/ a; F1 N( d+ @, m

  67. : F% Z+ p5 c5 L. k1 F$ Z" K. Q5 B( j
  68. dma_addr_t dmaphyssrc1 = 0;$ p5 G# V) @6 K, q0 Y) ^; [1 B6 i5 @
  69. dma_addr_t dmaphyssrc2 = 0;
    - s5 y3 V% r' p% k4 b! n
  70. dma_addr_t dmaphysdest1 = 0;( L9 O, L3 q- r9 }) m& N% R
  71. dma_addr_t dmaphysdest2 = 0;
    1 E9 ]! h2 `7 x/ r
  72. % l& j' X. x; A# Z' Q3 [7 z( _
  73. char *dmabufsrc1 = NULL;8 I( d0 P3 @3 }# \
  74. char *dmabufsrc2 = NULL;
    0 m0 r7 S$ k* \: P' J
  75. char *dmabufdest1 = NULL;- ]) x1 W3 r' p" t" b7 |
  76. char *dmabufdest2 = NULL;* {- |. H0 R) Y. y: l: U5 f
  77. 6 y  r+ T  r, \: z
  78. static int acnt = 512;
    : E) [2 x, Y& E' N& C$ J% d
  79. static int bcnt = 8;/ w6 g. {+ J1 O+ Q$ H. i
  80. static int ccnt = 8;: X7 h, q8 V8 `$ ?  j3 n% \
  81. ; p! t8 ?4 o) [  [# _
  82. module_param(acnt, int, S_IRUGO);! n2 M' M" K+ _0 W' `$ ~
  83. module_param(bcnt, int, S_IRUGO);+ E9 h0 Q+ {; |8 i' w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 n. U6 r. N' B3 E( p/ B! R  a$ O& a* q: A) F: f* \# u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 @; X" {9 h( x- k5 f" }5 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ e) B# ]) \5 \* G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G4 U+ f5 A( G$ e( z$ L" O: f& L1 [* S% f# L+ @- ~5 T& h
  P5 u  X4 m1 k# Y; e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-27 23:04 , Processed in 0.048264 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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