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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( M! a7 r! w, _. b" t( q
  1. [code]EDMA sample test application
    8 @  `* _8 o7 u1 A0 l8 s- b1 u
  2. /*0 w& R; r# k+ a$ b4 a5 I
  3. * edma_test.c$ D7 A2 `9 q8 q3 i' m1 ]1 g: |
  4. *' L1 s5 O) [4 g* g* C9 c6 J; [8 }
  5. * brief  EDMA3 Test Application7 Q0 w* O! K4 A& J: z
  6. *
    6 ?: o3 |! @; T* c4 M4 h6 B
  7. *   This file contains EDMA3 Test code.
    " S/ ^: o, C. b2 W( v/ P' V  R: r( }
  8. *% |" d; z3 Q% p$ ?- @, t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n$ q# R# s% m( `3 o( @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 f- k$ `" d2 ^6 M# e
  11. *         TO CHANGE.! A3 T( {) f4 z$ d7 F9 f+ ^
  12. *
    0 u1 Q2 F* S! O* e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y2 @2 T8 K7 c* a1 R: F, N
  14. *
    + s" z1 }% i! a* v" |
  15. * This program is free software; you can redistribute it and/or* j7 }4 E! v% _
  16. * modify it under the terms of the GNU General Public License as4 u% q; L! I( f: [: m9 {
  17. * published by the Free Software Foundation version 2.% O4 {/ b# N0 F) I9 R" F
  18. *' W9 Y& h! R% G1 K4 O9 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. ^! {' X; Z) ~0 _; R  \+ D  @
  20. * kind, whether express or implied; without even the implied warranty
    % v+ G" M7 L% k. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - [( o+ |- l/ \4 {( W
  22. * GNU General Public License for more details.
    2 ]6 D6 S# ]) _# C4 b5 t, g5 n
  23. */
    4 t: l) X* L( z7 \7 T$ n( i9 M
  24. . P8 h$ E1 a7 b6 X
  25. #include <linux/module.h>: n# y3 I9 @3 I0 m. ?  G( I
  26. #include <linux/init.h>
    5 G- W  p6 n- K6 v2 F5 b! ^
  27. #include <linux/errno.h>' N- \: U$ ^) s) d' a! M( @4 R7 ]) S- e
  28. #include <linux/types.h>: I' `8 s, c, u- k. i
  29. #include <linux/interrupt.h>
    $ o+ K1 S+ @# t* k: J, m1 H" H% ]
  30. #include <asm/io.h>
    $ C. _- H- X8 X) O  b0 c# Q. O* h% B
  31. #include <linux/moduleparam.h>
    . m0 f8 W% X; m0 u& f8 _! s# p! D0 F
  32. #include <linux/sysctl.h>& W% ?2 v9 c& I9 D
  33. #include <linux/mm.h>
    . K( N3 z- y: M  I+ J. G6 M
  34. #include <linux/dma-mapping.h>
    1 a5 G, x2 b$ d. S

  35. % P, o& p5 D9 h% a, e; r, z* U" W
  36. #include <mach/memory.h>- M) z' n$ m7 Z$ l) T; N
  37. #include <mach/hardware.h>
    ' G& e* M5 s1 i. f  Q$ w
  38. #include <mach/irqs.h>( v8 ?5 H& z8 z( U# k7 c8 M
  39. #include <asm/hardware/edma.h>
    / Q! U$ Q1 z( u

  40. 5 E. W: ~0 h0 A' j- \+ Z
  41. #undef EDMA3_DEBUG6 d9 j0 D' n5 z% h2 h
  42. /*#define EDMA3_DEBUG*/
    - t* I# ]1 ?. x" ]* S  U, `
  43. ) X. N9 d: y9 t& |
  44. #ifdef EDMA3_DEBUG
    * @+ ^2 r& r5 |/ H, f% h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 Z+ P, N, B/ p6 B, ?) E' x( h4 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  B+ m0 A1 g3 i0 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e/ z8 S, k! G* W5 o+ G* P1 U
  48. #else4 E# K" f3 _% s
  49. #define DMA_PRINTK( x... )1 a" R. L8 ~; R- d: x
  50. #define DMA_FN_IN
    . {7 K; ~8 Q4 {5 l9 k* v7 C
  51. #define DMA_FN_OUT
    : J) _& @3 `9 m* u5 i/ r
  52. #endif
    7 L* U8 l" i9 v, J$ m

  53. 4 L0 ^6 X$ z! y7 J8 t8 o( A1 L- {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' X# E9 a4 b4 u0 F+ b& `
  55. #define STATIC_SHIFT                37 I, w4 K% p( [2 v( d8 q8 J, ~
  56. #define TCINTEN_SHIFT               20
    & J$ O) ]  B. }4 Z
  57. #define ITCINTEN_SHIFT              217 j! v" Y6 `0 @+ s
  58. #define TCCHEN_SHIFT                22- r' P) X1 T( Y& G; k& Z# a
  59. #define ITCCHEN_SHIFT               23
    * D5 l2 i! j! c( L* x1 s; W$ S

  60. ) D6 S, K1 [- a$ Q; b8 l& T/ a
  61. static volatile int irqraised1 = 0;  o5 A& o, m1 j1 l5 V4 s  s
  62. static volatile int irqraised2 = 0;& j7 ?+ g" o* n( A

  63. 3 i% h, o2 q) b1 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 U: v& ?; b' d# P% ?* @4 X" A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M0 I! J% n4 ~' q( ~* h+ W. U4 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 u! \7 x- x4 B  t

  67. - _$ P/ W1 H3 r9 x$ @# `
  68. dma_addr_t dmaphyssrc1 = 0;
    $ K% d- l6 Q' Z6 m0 j4 m
  69. dma_addr_t dmaphyssrc2 = 0;
    9 }  r% s1 n2 u' ?( t1 v
  70. dma_addr_t dmaphysdest1 = 0;8 H4 L* `" n/ n! [7 }. A# J* B
  71. dma_addr_t dmaphysdest2 = 0;
    * K) m& j1 v* x8 D
  72. $ y6 _+ l; b3 n
  73. char *dmabufsrc1 = NULL;4 D4 j9 k& V0 ]$ I3 E, @
  74. char *dmabufsrc2 = NULL;
    ) Y6 R0 B4 c3 c
  75. char *dmabufdest1 = NULL;5 m! z$ {" ]) ~1 V! E
  76. char *dmabufdest2 = NULL;
    # `- Q" x* J  b. b
  77. 0 e8 z8 ?( |7 q! F
  78. static int acnt = 512;
    # U2 E* R; ]6 d; J
  79. static int bcnt = 8;
    + m0 ^0 `/ U) F2 |* l0 E% t) r
  80. static int ccnt = 8;. v4 f% s+ e% l2 z9 f

  81. 4 V! _; }+ m" `9 A; D9 F
  82. module_param(acnt, int, S_IRUGO);9 k/ y& u7 l8 H9 f
  83. module_param(bcnt, int, S_IRUGO);4 a  r# X1 d) T& g# O4 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  h% l/ m2 N, U. A& i4 }
" J& h) N7 m5 l8 p! {) q3 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, J& }. j" M/ v! ?, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, {0 v4 B6 b4 o) t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  U: C5 P7 F. Z# E  T$ a
2 F  N: w& ^; U/ Q( q
. i  ~5 a, Q1 c, J5 G& e) x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 19:16 , Processed in 0.039294 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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