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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # n- T6 o4 P) G) }
  1. [code]EDMA sample test application' l0 |; [# j) T# h
  2. /*4 [5 e( Y- B) E4 n; i7 K' b
  3. * edma_test.c$ V' e' R( j) R. c$ X, a
  4. *$ T& F% W5 W% s$ l, ]- {
  5. * brief  EDMA3 Test Application$ {% e) w! N; c3 w
  6. *
    & u" w1 \" N9 H( }: R
  7. *   This file contains EDMA3 Test code.
    5 L) V0 g* }/ m' a9 K; }
  8. *
    4 x% N# r7 Y" F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' E- f% I9 j$ y" M! y1 j. [) B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * E9 W" K. l( ^8 }5 r, L
  11. *         TO CHANGE.
    : R& O) _; N- m4 f
  12. *
    9 [' |# |( C! |+ N3 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - U* g7 a+ o' F# C& j1 X/ u) m% X" C% G
  14. *) F+ R) O$ C) c& M) v
  15. * This program is free software; you can redistribute it and/or
    7 @. q7 ?2 o+ e) ^4 z5 x% f
  16. * modify it under the terms of the GNU General Public License as
    " G8 \( f. I9 ^
  17. * published by the Free Software Foundation version 2.
    % ~# r% d6 |+ K- T5 a
  18. *
    ' W4 f5 |. q1 q5 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  d6 d. O! G% H4 G- ]. _+ N2 e
  20. * kind, whether express or implied; without even the implied warranty) O4 P( J: x. y5 g1 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % L, f; `" F& C4 C9 p. [/ t
  22. * GNU General Public License for more details.9 E, ~2 a7 [, W* m0 u
  23. */- J, w) C1 N1 t
  24. 9 m' r8 w" V7 a8 a! p7 q; ^# m1 M
  25. #include <linux/module.h>1 U' q$ |3 w% ~; b9 e; j4 B) M
  26. #include <linux/init.h>
    & M1 E2 l; |5 k# k
  27. #include <linux/errno.h>2 B( c) @  A6 E
  28. #include <linux/types.h>
    3 j( b$ l* Y& ~4 ^% @
  29. #include <linux/interrupt.h>" n8 p" r+ d# O7 p4 m8 W; _# l# ?4 z( u
  30. #include <asm/io.h>
    % E; i3 |* c* K
  31. #include <linux/moduleparam.h>
    ' W$ p+ d0 a$ c3 S9 A* K2 I
  32. #include <linux/sysctl.h>
    # Y; t6 r3 ?3 J3 n3 a
  33. #include <linux/mm.h>) \+ _. ^9 x! l/ V& H
  34. #include <linux/dma-mapping.h>% {4 x) O3 S0 p" \0 Q. u
  35. 5 a/ D8 F$ b% D+ c* u0 m
  36. #include <mach/memory.h>7 d" r* X- a5 d* |( }
  37. #include <mach/hardware.h>
    1 S7 t7 n6 x  \, D$ x$ Y
  38. #include <mach/irqs.h>! m" \& n- R1 t. T  N
  39. #include <asm/hardware/edma.h>
    * x% I% U" C% \# k5 J% F+ @

  40. / {( y$ @0 s1 M7 u# a
  41. #undef EDMA3_DEBUG
    8 L2 ]7 y5 j, A' W1 n
  42. /*#define EDMA3_DEBUG*/
    * \: B, S, h$ X+ [2 g
  43. 6 j% c, M+ B3 y
  44. #ifdef EDMA3_DEBUG, j; z+ x( a, u( y* H, x" Z1 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 `) ]- K, K) P) F3 W" v5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , z0 @7 J! l7 S! t7 V/ ?8 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% [# n' S; q$ ?7 H
  48. #else% w& X* D: a1 C) T, @% b
  49. #define DMA_PRINTK( x... )4 Q( i3 T6 f) h% R
  50. #define DMA_FN_IN% ~  [+ B' K! x0 D. X: O: y! |
  51. #define DMA_FN_OUT
    , u. ]  j: `) N: a; t
  52. #endif
    + H- O- A, v# z" V
  53. 6 Z* i' D6 ]* U7 k9 C1 y& K+ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ |9 r. J+ _; Z, {' c* ]) y& D0 _
  55. #define STATIC_SHIFT                3# T' B$ w. X+ I+ o
  56. #define TCINTEN_SHIFT               20
    9 ~% d6 M  k* k3 @7 a. D) j
  57. #define ITCINTEN_SHIFT              21
    ' o' f' [& ?3 t/ v- [  c
  58. #define TCCHEN_SHIFT                22
    4 y( J* o! r( |* Z7 D* O0 \8 d
  59. #define ITCCHEN_SHIFT               23
    & F$ y# u2 T1 t9 I
  60. $ B) o! }9 R( g# v/ v7 O
  61. static volatile int irqraised1 = 0;  I/ q3 w( I9 ~6 Q! h8 {
  62. static volatile int irqraised2 = 0;
    ; Q( H) S  s" i+ Y- R( X' n0 B% r
  63. ) N. V7 c5 ~# J3 U/ T8 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J6 O+ j# W0 A% c* n/ C+ F* O" K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) [! E0 D7 b1 T/ f1 n+ ~) ]7 z6 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : `3 U- c- r/ R/ R
  67. , |+ y8 ^% M" J( g$ f* [
  68. dma_addr_t dmaphyssrc1 = 0;8 W2 w6 \1 b4 u  u4 F
  69. dma_addr_t dmaphyssrc2 = 0;
    9 G, L* ~( c" z) g' {& r# g, x
  70. dma_addr_t dmaphysdest1 = 0;
    ) z' t4 i) ?# S+ N8 o& \' `
  71. dma_addr_t dmaphysdest2 = 0;
    , O/ N' \5 Y) r3 \% ?
  72. 3 N( r9 Z! ?, [
  73. char *dmabufsrc1 = NULL;
    + `5 @' E5 v5 e+ b# P2 J1 i
  74. char *dmabufsrc2 = NULL;
    3 c% S  M( k: e; F* Y
  75. char *dmabufdest1 = NULL;" R: `1 L9 y$ z
  76. char *dmabufdest2 = NULL;
    5 }# G/ D9 k+ n6 r7 Q7 V
  77. 6 q4 S2 Y2 V& U, r' {& o
  78. static int acnt = 512;2 {& ?) y9 h1 U7 J' l2 R, t; p
  79. static int bcnt = 8;
    , e) |; H. \* p& @4 Z8 T: r5 a
  80. static int ccnt = 8;
    + p) Q( h" i: J

  81. " O! D+ s5 y- ?! T# l$ T% ~
  82. module_param(acnt, int, S_IRUGO);: Y/ C, H  L- c/ _
  83. module_param(bcnt, int, S_IRUGO);  E3 e7 C8 c$ T* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  c" Q0 J( B5 }5 P4 k0 j4 R

2 h( t8 z7 F1 g! S) W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 G! g2 P1 X: M, z# m5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 J. j3 ?6 C5 [$ Z$ E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' }" z! G6 R* m) U* b  L
# X) M) i" D# G1 [9 M
; ~) }1 G- Y) D6 o5 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-21 10:18 , Processed in 0.044017 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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