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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 D* S! |$ f# M5 i3 m9 `
  1. [code]EDMA sample test application1 H) y2 j8 {4 \. Y, v+ P
  2. /*
    ! F7 v6 S, [9 l7 ~
  3. * edma_test.c
    3 v/ k; ?/ y# {7 F( O0 x  {' h  @
  4. *6 t" B  D, m4 k+ f* n0 \
  5. * brief  EDMA3 Test Application. F8 f* q$ P; ~
  6. *
    + e1 C, \! Y5 Q+ b2 g
  7. *   This file contains EDMA3 Test code.
    + r/ U! B4 b2 Y4 s, b; Y
  8. *; X3 m0 a" W) F4 X: r% f' `; m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 s6 j( Q- Z9 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 F4 _& n: |# l+ n: n
  11. *         TO CHANGE.$ q( l+ Z. A2 V' s
  12. *$ D4 o' U& w+ Y! x7 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W- y  d6 k+ z2 S7 V
  14. *
    ! }4 L( @$ Y7 p( q8 B
  15. * This program is free software; you can redistribute it and/or+ l) C, O& W  v$ N- f) a0 y
  16. * modify it under the terms of the GNU General Public License as
    , `4 R9 p5 A. s! v9 x6 T- X6 y& S
  17. * published by the Free Software Foundation version 2.
    # p) O; v2 m. D9 Q. Q
  18. ** _. D# \# t, C* T0 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . f5 ?3 O) ?  E; d
  20. * kind, whether express or implied; without even the implied warranty0 F3 s% t; \* g& t1 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 i$ W9 n$ s1 A! T8 ]
  22. * GNU General Public License for more details.; y9 l" E: f9 a0 c+ X0 R
  23. */
      ^; w1 c. F& I3 |. e% I4 O
  24. & A" m; F" _( h$ S& o
  25. #include <linux/module.h>* _+ ]! O( }2 ^& f$ R7 }
  26. #include <linux/init.h>
    4 U4 L" h8 ^; D" `, x7 ^
  27. #include <linux/errno.h>. k5 l0 a' p# ?3 y( B2 k1 }' ?
  28. #include <linux/types.h>7 O9 ]4 b+ f5 o- w* V5 s
  29. #include <linux/interrupt.h>$ q5 n( ^& D  }7 w2 e3 B5 P
  30. #include <asm/io.h>
    % D  K# R; M- f% |/ P2 f" m, U
  31. #include <linux/moduleparam.h>
    3 Z- B6 K9 b. \3 x- H* h
  32. #include <linux/sysctl.h>
    / s9 r; o& b" E/ J9 G6 s& h
  33. #include <linux/mm.h>) {" g6 m  X! S1 X- u8 ?
  34. #include <linux/dma-mapping.h>( R2 W# B: x" {6 j+ r0 ^! U* g

  35. 9 M" U0 D- V" b: R7 W# G% D( I# R
  36. #include <mach/memory.h>; c, \) k: k# B" o4 M& [
  37. #include <mach/hardware.h>, y  i6 o2 v: P  n  [4 E0 h
  38. #include <mach/irqs.h>
    1 k5 r, s! G1 _# r. h$ @4 K' G
  39. #include <asm/hardware/edma.h>1 ^  X: Q" H2 ^8 ]* r

  40. 9 A1 _  M/ G+ `
  41. #undef EDMA3_DEBUG2 @! k+ p8 d* K/ _2 i, m' \% N7 v) R
  42. /*#define EDMA3_DEBUG*/
    ) I+ W, {/ }# Y" j# ^+ f5 t; \

  43. 6 B$ g" R& j# b# H4 X$ H) M+ ]
  44. #ifdef EDMA3_DEBUG% c, i" A/ W8 s" n9 F* t9 J* F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 {$ S4 B# Z! a; j0 T; G' d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* C6 {8 u0 v" _& J1 z) w; m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' I. S$ E6 C+ Q. D, Y
  48. #else
    5 ]- F0 U" I  \, B- m
  49. #define DMA_PRINTK( x... )$ H/ k( X- W3 j0 ]
  50. #define DMA_FN_IN
    / s. ?6 X/ R; X! C8 T5 B
  51. #define DMA_FN_OUT
    ! H; _- @& A; Z' G& \  o! i7 a
  52. #endif0 f% c- Q% Z% ]: Y
  53. * o+ I( ~; J' g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  c, v8 f) Q( |
  55. #define STATIC_SHIFT                33 N. _% r# y8 S  s9 @0 }; {
  56. #define TCINTEN_SHIFT               209 J5 ]& l& Z2 L2 n
  57. #define ITCINTEN_SHIFT              21$ Y; a9 V0 e1 x/ ^" ~
  58. #define TCCHEN_SHIFT                22
    , [1 ~* r/ B/ v2 u: @# s& R
  59. #define ITCCHEN_SHIFT               23
    5 K/ i& i# s& |% {
  60. , P/ H6 U+ B  ]4 f  E& g5 n- x
  61. static volatile int irqraised1 = 0;8 A! A. l2 }! z" B7 S5 l6 S
  62. static volatile int irqraised2 = 0;8 p& X1 S; E: F% X; u- x) ?  X

  63. # P' V0 J3 ^4 K$ f! a" O& m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 I! }9 O+ Q6 I4 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A; v% p0 ?/ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?$ t! {8 a7 F/ h2 @
  67. 0 B& S5 R5 N8 `4 ^3 ^' m/ m
  68. dma_addr_t dmaphyssrc1 = 0;
    : ?3 l: ^5 B5 c! K! O( E/ m
  69. dma_addr_t dmaphyssrc2 = 0;2 |8 k+ C; Y7 R- q- a- @
  70. dma_addr_t dmaphysdest1 = 0;6 \; V( A0 _6 W8 b' |' X3 A6 z
  71. dma_addr_t dmaphysdest2 = 0;, r. L, H8 G7 w" G2 w! y( B! m. |
  72. & J0 e; a2 U4 L3 l0 W
  73. char *dmabufsrc1 = NULL;
    3 U2 y9 I' K& V9 C; }
  74. char *dmabufsrc2 = NULL;
    3 Q4 L6 Y9 C4 b% i1 D& g
  75. char *dmabufdest1 = NULL;+ v5 j8 f/ T1 j+ E! u/ s* m' w
  76. char *dmabufdest2 = NULL;7 `$ f, Q4 |3 `8 U
  77. ; o6 }$ Z- B( K; T
  78. static int acnt = 512;
    0 O  g0 w4 y) l# c
  79. static int bcnt = 8;$ _4 ~; ^$ N3 t  N, D
  80. static int ccnt = 8;
    $ n# Z* d6 K- H2 S! v! I

  81. ( u5 G0 e2 Q$ }) M% Z( h( l
  82. module_param(acnt, int, S_IRUGO);4 [$ C- l/ m+ _) n
  83. module_param(bcnt, int, S_IRUGO);
    " S' `  t: q7 O& s+ N/ d6 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 m8 `6 ~) M) u% O) G5 l4 k
3 }3 [8 c+ u& G4 q  g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. b8 f5 e, D! H8 U$ j. W2 ]" \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ i% a+ ^2 [3 y( J9 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q2 I8 o; W: F3 f  x' N" ^* a5 y' L% N9 Q7 Q4 U7 o" J5 l
  z! H' z% T: `. y% K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 06:43 , Processed in 0.038685 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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