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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( D% a" M* r* g5 o
  1. [code]EDMA sample test application. k9 b' H, p0 u
  2. /*: w4 }+ Q( w$ i
  3. * edma_test.c
    * }5 e* q! W' Y# o
  4. *
    ! K- G5 c, {0 x# B
  5. * brief  EDMA3 Test Application
    0 ?& j$ N. G; d" W1 L* |
  6. *
    - e. H, f0 O2 [/ J+ P4 ^2 k
  7. *   This file contains EDMA3 Test code.
    ( Y8 }# o9 U- T1 x; i" Y' g, Q& z
  8. *
    . U" f! F: N$ @* F2 R: k* ?  `4 f; X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ o, _% q" ?7 ~. m/ l0 T8 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) F; D, p0 M) t; g  V3 o! b) l% R4 J1 {
  11. *         TO CHANGE.
    , u! Z0 s9 S8 V9 o9 R
  12. *4 x7 o  n+ M# t9 J2 b) b; w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# q5 a6 x/ U7 Z9 W2 u
  14. *
    ) h* D: ~, T7 o. X5 d% J$ l; X3 Y& ^5 j
  15. * This program is free software; you can redistribute it and/or8 `% B- O7 X( e% v$ P& b
  16. * modify it under the terms of the GNU General Public License as& w* |* @8 K4 I( ]- M; h
  17. * published by the Free Software Foundation version 2.
    9 F; S& n0 q# S! [
  18. *
    : p# w! e  W/ B7 Q! y- g0 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; z+ }9 _. D6 l0 K' b
  20. * kind, whether express or implied; without even the implied warranty/ f& n# U2 A. Q' O# }: Y  {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " U& Y/ y: ?+ X7 m2 W  e, h+ U
  22. * GNU General Public License for more details.
      o% P: S: G- ?8 k; [
  23. */
    ; m) X. I! h, C3 t' y1 r4 \# L

  24. 4 U  P9 r6 Q7 @) c  E
  25. #include <linux/module.h>
    5 Y- u) x& Z2 h3 B- X
  26. #include <linux/init.h>
    ( b+ M. K% r6 T  o5 U0 {5 P/ \
  27. #include <linux/errno.h>8 f% ]4 S. e: N4 f- R* A# |
  28. #include <linux/types.h>
    # N) _/ x! D5 F9 T
  29. #include <linux/interrupt.h>
    ; c/ e" x4 e5 P9 n0 ~  H
  30. #include <asm/io.h>
    * N0 [) K2 M+ V6 Q# U5 z# A1 R
  31. #include <linux/moduleparam.h>/ ~) {6 D! h$ \, k
  32. #include <linux/sysctl.h>0 f3 I7 I9 T/ t
  33. #include <linux/mm.h>
    8 v8 |) u8 i  Z% t* `: E; ?
  34. #include <linux/dma-mapping.h>
    / Z6 X, ]: T3 ?  t. I9 D3 c. u
  35. 0 n; h1 C+ ?3 Z- L& ^/ t
  36. #include <mach/memory.h>
    9 @8 _& f+ a+ U" R1 N6 @- S6 t
  37. #include <mach/hardware.h>
    ! W/ x) w, ~2 a- U& W+ |' f6 r& o( q
  38. #include <mach/irqs.h>
    : O" j! y: c1 W% w; b' P/ B# q% E. a
  39. #include <asm/hardware/edma.h>
      W* ]2 B( X2 O( R* S6 t0 ~, t6 w" v

  40. 7 z( D) v$ N: {5 j) e- b0 A3 i
  41. #undef EDMA3_DEBUG
    : O$ b+ _2 D" j- u
  42. /*#define EDMA3_DEBUG*/+ y) ]8 R3 ^1 r# s

  43. $ Q% P/ P5 I9 a% `
  44. #ifdef EDMA3_DEBUG" Y9 s. @" X" ?7 i8 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% i+ l& @; O1 C& R- T) v( a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / V" O8 F# l. a/ s7 r& {! T, B: J7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 K; Q/ a: L  a/ z. v9 e& n6 O
  48. #else1 L) j: W0 x1 p1 E6 `
  49. #define DMA_PRINTK( x... )/ o% X1 N# F( K; G; _
  50. #define DMA_FN_IN" M: L/ L3 _! ]! ~0 r* V8 G: m
  51. #define DMA_FN_OUT
    # t" I  s. F1 C; C8 s1 p5 u
  52. #endif7 U) ~" [6 n4 f" |% S$ \6 ~
  53. $ S( b1 j4 u2 K. S8 Y6 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 L" F" W- ?$ @0 N) R7 i( [/ j( s7 o
  55. #define STATIC_SHIFT                3
    , Q: Y# }0 h: V! r
  56. #define TCINTEN_SHIFT               20
    & B3 T5 h5 ~9 K! ]8 y  O% a5 P  Z7 w
  57. #define ITCINTEN_SHIFT              21
    3 T0 e7 Y+ a+ a5 B5 J- j
  58. #define TCCHEN_SHIFT                22
      x% M) [  [+ ?
  59. #define ITCCHEN_SHIFT               23
    * K; \( J" |' w
  60. 4 b; x( A* C" @+ G
  61. static volatile int irqraised1 = 0;
    8 ~: u8 b- h$ X- i8 R& O
  62. static volatile int irqraised2 = 0;
    9 }% e7 g6 Q3 k* j

  63. 9 s1 `# G; z" R0 |  L- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# U/ I" d' |! F/ f) x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y7 Y% ^0 a5 d- j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A0 {+ Q3 H# E

  67. ! c  [& ~, b) b0 I  W# O
  68. dma_addr_t dmaphyssrc1 = 0;' ~" J5 y6 R5 m( S' \( t$ b7 V
  69. dma_addr_t dmaphyssrc2 = 0;3 V4 q, Q" v$ Z
  70. dma_addr_t dmaphysdest1 = 0;
    - s4 ^3 p4 q) p% g' u5 |
  71. dma_addr_t dmaphysdest2 = 0;( H8 q+ b2 d8 _" g! d
  72. * O7 W  ~; e( d# w
  73. char *dmabufsrc1 = NULL;$ P: d5 r  a1 Y7 F+ D( z
  74. char *dmabufsrc2 = NULL;4 @3 d$ w* \  e2 C
  75. char *dmabufdest1 = NULL;
    ) _: a6 b% I9 `- t! }( _
  76. char *dmabufdest2 = NULL;
    2 v! d1 g  E# D& @3 F
  77. * d# O( `# K, R' ~
  78. static int acnt = 512;
    9 x7 L! F: W+ J4 D4 B  o. h& c
  79. static int bcnt = 8;
    1 V3 ^% C3 m. `2 y
  80. static int ccnt = 8;
    ; e2 D0 g( F; g! j
  81. 0 F( L% d- G# i+ P$ v
  82. module_param(acnt, int, S_IRUGO);
    3 J' i; Y  G) N; C* b, c5 S" y" w
  83. module_param(bcnt, int, S_IRUGO);
    3 R& {0 U7 Q4 k2 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& z0 [$ L+ s& t: P: `: ~* P; _
$ K: [5 J5 B: U" e, R+ X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 w7 c1 w6 r! \" k9 ~6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( x1 a  J  b* O4 n" f% D. o8 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! e8 h4 W# x: w4 c6 M

5 Z; V7 @3 A' y# j2 ^; L& z0 {- J/ V; Y6 X: `+ X% |7 @' Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 05:38 , Processed in 0.041340 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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