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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; d6 c6 J2 |7 {8 r  p* `6 [
  1. [code]EDMA sample test application
    ( `% h) g2 I' ?) @
  2. /*2 N) N: f$ v! f% e& I3 [  d* o" x
  3. * edma_test.c$ h. q/ B; W# r6 l' |, J' J' s- A0 A
  4. *
    - Q7 K& k  B# e  i3 }* P# }
  5. * brief  EDMA3 Test Application
    # H: V' u9 j0 h2 C: W
  6. *( d4 _* [: v$ p5 `+ o" I+ l) a0 s
  7. *   This file contains EDMA3 Test code.
    / l- K- p. ]4 K; c$ }
  8. *
    7 I: m! A( D* M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. Z! p+ b& `9 r1 Z/ }/ Y3 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % h6 y1 t( s* j. p& b# Z! W& J9 D
  11. *         TO CHANGE.
    9 w9 I2 G0 Z* n0 ~
  12. ** J8 {/ b' g. S/ d! X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 P, h9 y) \) L" Z7 b; D
  14. *
    - r: u; d( c# ]4 r9 `/ m
  15. * This program is free software; you can redistribute it and/or
    " m4 R5 Z) x! b1 E! s7 E' y0 O0 [, G
  16. * modify it under the terms of the GNU General Public License as/ ^) J2 n4 v; S) k5 t8 H! A
  17. * published by the Free Software Foundation version 2.( ]: r9 S0 q: s- ?" W
  18. *
    % J* C5 E1 }& f' L# f" J' |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 p  C; O7 K) e  v' q! O
  20. * kind, whether express or implied; without even the implied warranty3 _  F( ~% V$ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 r7 C0 _. ^$ s& U3 u$ Z
  22. * GNU General Public License for more details.; U/ X4 u5 w) ?
  23. */
    / f5 i' t9 {& E: ^5 R+ K

  24. , ?+ j+ Z. W5 v& B# T4 g3 z
  25. #include <linux/module.h>; y- p1 c4 h6 G  E6 x* W- y9 O
  26. #include <linux/init.h>
      ~' `+ x2 _9 X0 i
  27. #include <linux/errno.h>
    , \0 A: r" Q- t0 t$ X
  28. #include <linux/types.h>
    ' [2 [. k& g; T/ {0 Z5 o* h
  29. #include <linux/interrupt.h>
    - {0 I- C  ?4 o& j2 b  m
  30. #include <asm/io.h>
    3 ^! T: ?& M7 J1 E  R
  31. #include <linux/moduleparam.h>- P; L1 U0 b2 F2 v$ e3 m$ @
  32. #include <linux/sysctl.h>8 B, u6 P2 }4 ]+ Q
  33. #include <linux/mm.h>
    ( Q- B# g) D  e8 u  a
  34. #include <linux/dma-mapping.h>7 G. U9 o+ n9 q5 J+ H! \7 z9 @

  35. % f+ V/ E' W+ {( A
  36. #include <mach/memory.h>; N5 ^. s1 @8 ]3 ^- x: W1 m
  37. #include <mach/hardware.h>0 X' W' _  {+ q% f$ P$ h
  38. #include <mach/irqs.h>
    , u: M1 V2 |0 S5 T3 B% l
  39. #include <asm/hardware/edma.h>. O. C2 a+ F, C: _9 F

  40. 1 f% J  |5 Z; V; M  `
  41. #undef EDMA3_DEBUG- g% F; U. U# q7 o; h
  42. /*#define EDMA3_DEBUG*/: T" G. f' `; ]( f

  43. ; W. _! I# n, c: K
  44. #ifdef EDMA3_DEBUG
    0 }  M) a, C3 J6 n* ~% \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; }* G) ^' l/ N. \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , u$ w8 E+ t+ M% D! C" f/ @2 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + m0 ^/ R8 k4 L$ T; w! P$ A" |1 j
  48. #else# H: {6 T# m1 |3 V4 g- X) m- j6 a2 w  B
  49. #define DMA_PRINTK( x... )4 i  p- E$ c* [. E: J3 u6 s( o
  50. #define DMA_FN_IN
    - D+ I# k; x3 q" U* ?
  51. #define DMA_FN_OUT
    1 y4 D4 A: ~7 P# t
  52. #endif/ m- R# H% N! L& i3 j( `% C

  53. * X. W5 L" Q$ `6 u/ g. ?. c9 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 b$ ^. Y% n1 A& i# C' L
  55. #define STATIC_SHIFT                3/ o4 A* n! J7 R0 |( H
  56. #define TCINTEN_SHIFT               20
    + a% m2 {2 g, Z# n9 F" ?7 B( q
  57. #define ITCINTEN_SHIFT              21, I; L9 A% ?; l/ r: o$ l
  58. #define TCCHEN_SHIFT                22
    % a3 T# f" \" q) C! R1 R
  59. #define ITCCHEN_SHIFT               23
    - u- F% a2 e' P: A/ H

  60. 5 d+ B3 |& L. r5 X
  61. static volatile int irqraised1 = 0;5 p( {, A( E4 \5 \3 T. L0 R
  62. static volatile int irqraised2 = 0;: L7 L4 q% F0 ^1 }0 q$ _! c

  63. 0 K6 s4 U: F. X+ H6 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k1 Z4 Y" |1 m4 A: ^( G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Q, M% }# e* v  q& w: W, B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % a5 I7 B$ g7 s' E. V" j1 J5 G

  67. 2 u# x1 o! ?) D3 x# N# j7 m7 c* O& S0 t% g
  68. dma_addr_t dmaphyssrc1 = 0;3 E) z$ b# X' u$ M$ \! R
  69. dma_addr_t dmaphyssrc2 = 0;; x0 E$ X" T1 N( g5 G, }
  70. dma_addr_t dmaphysdest1 = 0;3 a2 y. a9 m6 V, |- d" N
  71. dma_addr_t dmaphysdest2 = 0;
    4 g* R7 M. g6 r  S, Z) L4 {
  72. 1 |5 u7 }* g1 F
  73. char *dmabufsrc1 = NULL;& A# u7 i+ v" A
  74. char *dmabufsrc2 = NULL;: V4 D2 S. f* t" Q5 j! H; L6 ~" ^
  75. char *dmabufdest1 = NULL;
    0 u' L. P. C* x7 _
  76. char *dmabufdest2 = NULL;) C; {* O0 H, {
  77. 8 X2 S, x- |# g( Z% W9 q
  78. static int acnt = 512;! i( a( C# x  @7 O2 m9 L
  79. static int bcnt = 8;9 B0 L. W3 B+ m% [4 k5 ?' _
  80. static int ccnt = 8;
    & z5 B6 S, q9 T3 F8 Z; l: I, w, O) r

  81. 5 N; I) f2 j2 k; [1 Q# T5 k" R
  82. module_param(acnt, int, S_IRUGO);' C, t, r3 Q3 ~" B; D" |% e/ [9 ~
  83. module_param(bcnt, int, S_IRUGO);
    & Z( S: z# w/ m! V" f3 d0 q( x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 `0 X/ n' x% b
% {- X5 ?7 A1 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" `: n* o  Y0 c3 {1 |7 u- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- h! @9 l) b* D5 ?  @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 h: M  d! |: L) R. Y

% n0 S: w" P# P3 q# K
3 [/ j; r2 M+ U4 s' N* m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 21:19 , Processed in 0.045969 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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