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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x3 k/ ^- S! z  t! c5 L
  1. [code]EDMA sample test application. V1 i% l, V  s* [
  2. /*) U/ T6 M* N  n- _
  3. * edma_test.c) E6 H0 p! Y5 d. B3 ]
  4. *
    2 e4 x! J( ^: _1 @0 [
  5. * brief  EDMA3 Test Application  W+ [" A. p0 @' u: `
  6. *% R, D0 X. W: ^4 j" U5 \7 N  w
  7. *   This file contains EDMA3 Test code.  N6 ]( h% q; X
  8. *
    2 x. P# D/ }0 E/ A; [4 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p3 S2 u% `3 [+ A" N! C* \* \2 F. k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 R" I( O2 x& r& Z: _% J
  11. *         TO CHANGE.9 }+ V' R9 m7 `4 ^: p
  12. *
    9 w" r# H8 x$ X' N/ t' Y: ~, J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 A. m& g5 f3 Q# H7 P$ X/ L
  14. *
    # `5 a, ~5 x( I3 N1 T& u/ X" }1 q8 G
  15. * This program is free software; you can redistribute it and/or8 ]9 Z! h) X2 [, q
  16. * modify it under the terms of the GNU General Public License as
    . Y$ Z/ ~( h4 k* x5 [( p
  17. * published by the Free Software Foundation version 2.( l9 n2 |2 c# f& O
  18. *5 `, N" b) g) v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 R+ Z5 c" S5 {5 F: V
  20. * kind, whether express or implied; without even the implied warranty+ U' {6 p* o1 `* e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : b' A# |/ [/ l
  22. * GNU General Public License for more details./ T# I; U( x# E, [% r& d! n& F
  23. */
    ' n+ K6 K7 B4 m

  24. ' Z0 k+ x1 l' A" b- C7 \/ H. _0 J
  25. #include <linux/module.h>
    2 S( f' M) ]; d3 s" m' x# i5 i
  26. #include <linux/init.h>4 H6 C1 M; r$ m5 v4 ]& {
  27. #include <linux/errno.h>
    , E+ L- C+ r1 T/ I) e
  28. #include <linux/types.h>
    , Z& x; G' Q7 y# {% b; r
  29. #include <linux/interrupt.h>  F0 l1 _, I5 Q0 l- @6 R% R
  30. #include <asm/io.h>
    ( X& x+ R. w1 s
  31. #include <linux/moduleparam.h>3 x/ {) t. f  |, M- h
  32. #include <linux/sysctl.h>
    8 a/ m* I- @& X1 m. Q
  33. #include <linux/mm.h>
      x6 ~( `& Y% n" e, E0 z- P
  34. #include <linux/dma-mapping.h>' P) p0 c9 z- I& D( B, W: b
  35. 2 [; R: J& _0 X4 C. o0 h8 s/ q( I
  36. #include <mach/memory.h>
    8 J& y! S- B" e8 A' X2 R
  37. #include <mach/hardware.h>7 b0 |& ~7 C9 l* V' E% `3 i
  38. #include <mach/irqs.h>' Z- U% S3 c" i9 r+ h! u; e* x: `' O
  39. #include <asm/hardware/edma.h>, a9 d6 B: w/ ]* n1 g

  40. 4 J9 ^. u% A* H0 E
  41. #undef EDMA3_DEBUG( P+ }$ R5 w# N
  42. /*#define EDMA3_DEBUG*/' \( J& k% k9 I; U" m5 Q
  43. 0 y+ D0 B* k4 W4 }) `
  44. #ifdef EDMA3_DEBUG' }/ {, m3 S* y! q7 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& D0 q( c2 t' c& e" a" M6 H( L' b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 v& V: v4 b8 b$ u% _) N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ v% T! f. F; W' m
  48. #else2 l4 {, P# _+ h+ ?
  49. #define DMA_PRINTK( x... )0 ~. z# H4 k( `- z1 K5 n; S
  50. #define DMA_FN_IN5 Y8 F; r  c% i# m
  51. #define DMA_FN_OUT
    ) y- h4 M) Q: X4 A9 F
  52. #endif  Y8 z5 b( c& X( Q: p0 g

  53. , a4 }6 F$ p* K, o& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / j- ^# _9 g$ |9 j
  55. #define STATIC_SHIFT                3
    - t  j2 A& Z$ _; `8 Q* g7 r" X
  56. #define TCINTEN_SHIFT               20
    + n0 ?  Q1 S) O" t/ ]
  57. #define ITCINTEN_SHIFT              21
    ) Q2 }8 T; j; `: _$ |, m
  58. #define TCCHEN_SHIFT                22
    , C) ?3 {' q8 F! `+ {5 i
  59. #define ITCCHEN_SHIFT               23
    7 D- a/ F* M$ a$ u: d' b

  60. 2 P% J+ M6 p9 W; ?2 I* h
  61. static volatile int irqraised1 = 0;" i( h& n  H% S& |1 k4 V$ y
  62. static volatile int irqraised2 = 0;
    / T& F2 j3 S& Q. i, s
  63. 1 J6 G, K/ S$ p) ~8 z0 [# C& L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z/ z) ]" D. r% k! G7 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P" \) o# \8 I" f0 X6 ?) p  I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * y8 n+ ^) N* A) V; P
  67. " U2 U. J, `4 n
  68. dma_addr_t dmaphyssrc1 = 0;
    + L7 p& D; p4 C3 j
  69. dma_addr_t dmaphyssrc2 = 0;
    * g# z9 a  F8 C+ j) u1 N& c
  70. dma_addr_t dmaphysdest1 = 0;- B- R( V' |* P& Y6 h+ p
  71. dma_addr_t dmaphysdest2 = 0;
    " d6 m4 i4 a' D3 o9 ?3 \7 U

  72. / K0 n) z( ^/ `6 N- k' q* R
  73. char *dmabufsrc1 = NULL;
    $ ~2 `" I' p8 C" l! W8 W
  74. char *dmabufsrc2 = NULL;4 ]  x. r3 k% K9 ]; f) Y5 t
  75. char *dmabufdest1 = NULL;
    - o* g* k! q) q- x
  76. char *dmabufdest2 = NULL;
    * s0 R6 C) t) X: q' O7 Q* V
  77. * Z+ E, w" y! b5 m" Y1 x
  78. static int acnt = 512;( ^6 X3 S( ~$ [; i+ e9 ?- d
  79. static int bcnt = 8;* w2 ^8 l* Z: P* h4 O& ~9 L: y
  80. static int ccnt = 8;
    ' j! d1 M5 V5 e; x
  81. + p$ I( M" f3 h2 a; }% ?4 j5 d6 z, y! A/ }
  82. module_param(acnt, int, S_IRUGO);7 \4 y/ N$ U* A( D
  83. module_param(bcnt, int, S_IRUGO);
    9 x) P, G$ Y+ _) x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ }( W( S, x4 w6 P9 x  z% {5 z1 Z' d5 k4 {5 ]& [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 W; e8 b5 p: \4 u+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ], s/ F9 l2 [3 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  c" D% Z  r3 T- G0 U3 ^6 `% z0 t
+ J7 }2 h6 O2 W' s
( G" n5 _% i0 Y+ _- v8 }; w9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-26 04:53 , Processed in 0.045961 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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