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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 E  T# c. f3 J/ d' X- F
  1. [code]EDMA sample test application
    ( `3 Q9 U& ^" O" J# s5 P
  2. /*
    3 _% Z4 O) c% R/ E% y* T2 _
  3. * edma_test.c7 P( }. H% o6 ~2 I* Z: B
  4. *
    7 {! Q" N8 R4 r$ i8 m) f
  5. * brief  EDMA3 Test Application% f5 [7 o! z; V+ Q$ r* q& V
  6. *) N% [0 X5 q- Q; g3 D( S+ P- R
  7. *   This file contains EDMA3 Test code.6 B8 L& j" j! l' w' G7 _8 p' D: N/ [
  8. *
    # ]7 ?( m) Q; n% ^, H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 i5 y8 D) f8 ?6 M. ^% D% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a; i$ h  N1 ]; F- ?- v: k4 p7 ~
  11. *         TO CHANGE.& N3 F, e9 f" u9 z& n- s! `* D1 \
  12. *
    & ]2 i+ O0 o8 y8 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , L# d8 D# O. I- g+ t' Z
  14. *
    : |9 _0 J8 M; N  b7 s" P0 _4 f
  15. * This program is free software; you can redistribute it and/or1 S$ A7 i' E- U6 O) ~
  16. * modify it under the terms of the GNU General Public License as
    8 |& c; t9 b( {
  17. * published by the Free Software Foundation version 2.7 X, l3 S/ d; X' t& H+ f" T
  18. *5 I' y4 H% T( Y2 [8 B2 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( d% L5 D" e& h7 I
  20. * kind, whether express or implied; without even the implied warranty7 {0 q) i% z6 v+ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 T; t. l( ~# u" R* b& @
  22. * GNU General Public License for more details.8 z! g  A1 T3 K
  23. */
    * w9 m: r4 C$ E% T9 r+ P, v, `

  24. * b0 p2 }; ^- V' E. E9 d* V& I
  25. #include <linux/module.h>7 C" B5 X2 o3 t2 Z: P: M* o  L
  26. #include <linux/init.h>$ V! Y; m/ }; @" M
  27. #include <linux/errno.h>7 b( Y) T5 u  ]$ \. g% G7 \  B9 I
  28. #include <linux/types.h>7 e6 c" B6 H5 ^$ B
  29. #include <linux/interrupt.h>
    + b1 ^) N  G" r. X  ?& c
  30. #include <asm/io.h>  O6 S, F1 e% U5 t
  31. #include <linux/moduleparam.h>8 T" c2 ?. K% Y( V" r
  32. #include <linux/sysctl.h>
    # h1 x+ |: `! F. z; b
  33. #include <linux/mm.h>
    # H' [3 R. d6 O" i! W
  34. #include <linux/dma-mapping.h>
    1 U. I( F  }% e' G6 u% d, {
  35. 3 u3 L9 m. R) f
  36. #include <mach/memory.h>) q! A3 m# P+ j! o
  37. #include <mach/hardware.h>
    4 E% h" p' h% X( w8 H
  38. #include <mach/irqs.h>
    % e* W: _( P# a$ O
  39. #include <asm/hardware/edma.h>6 e! F* U+ `6 j5 x) s
  40. 6 b( D6 M' E8 ?8 [
  41. #undef EDMA3_DEBUG
    0 C( o# F/ [7 Y9 h
  42. /*#define EDMA3_DEBUG*/
    5 Z  ]8 z' c& j6 b# @! K
  43. , z! ^5 Y; T9 j& u  Y
  44. #ifdef EDMA3_DEBUG
    " `' [6 }/ `% u+ D9 h( m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ]. Z, j5 i: e6 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e" j" J7 s/ |1 ?$ l4 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): f& J& q6 h( A* G: w3 A
  48. #else
    2 `" ]( O* {& a7 n: Z! r& m5 W# c- S
  49. #define DMA_PRINTK( x... )  o& b$ C5 k( x6 m1 w; R. Z. |
  50. #define DMA_FN_IN7 L3 a- {3 _# k, w0 i
  51. #define DMA_FN_OUT% I, R; X% `9 F* ]! D
  52. #endif- J1 x; P( e8 x
  53. 7 M7 }$ o) A+ ?6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 R/ _' f% R! q& Z1 Y* F
  55. #define STATIC_SHIFT                3+ p/ W" l; q% v. {) ]
  56. #define TCINTEN_SHIFT               20
    . N; r9 S* h( D
  57. #define ITCINTEN_SHIFT              21- j0 \3 o0 C+ l( P& [' d: o8 H& O
  58. #define TCCHEN_SHIFT                22
    , Y" M8 @/ x5 w7 e8 V5 U9 [
  59. #define ITCCHEN_SHIFT               23# \+ k7 d6 \* b/ D1 a
  60. 3 O, u5 g+ C4 R/ ?7 _
  61. static volatile int irqraised1 = 0;- U4 ]! A# ?& E  q
  62. static volatile int irqraised2 = 0;
    ( W: Y' U' S* I" c/ B3 P9 i& p

  63. 3 L, V6 Q3 Q$ E. a1 N8 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % v; K! ]: F& _2 Z0 p+ h5 h# B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % W( D& j; g& l$ N4 w! S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?1 K! Y3 o0 b4 v( d$ i
  67. ) b& z+ z% D9 X& }# a: y4 i
  68. dma_addr_t dmaphyssrc1 = 0;
    + M- M9 W$ P( R5 _5 ^1 G
  69. dma_addr_t dmaphyssrc2 = 0;+ ^0 q7 \) n: F3 \" K( n- a
  70. dma_addr_t dmaphysdest1 = 0;
    7 L; x( F: M2 G3 K% K
  71. dma_addr_t dmaphysdest2 = 0;
    7 f+ Y% t& T! L1 h! Z

  72. 4 o% i6 C& H- [! U. V2 u  s* [
  73. char *dmabufsrc1 = NULL;
    , `* S; R7 m' J# ^: o
  74. char *dmabufsrc2 = NULL;
    ' }4 ]) `3 P' M
  75. char *dmabufdest1 = NULL;7 m9 {3 R( J+ X% }
  76. char *dmabufdest2 = NULL;
    ( A1 ~8 {( `2 W! y$ A, C7 O/ ~- Z5 t5 F

  77. / N: w& `- l( I/ c/ q9 u
  78. static int acnt = 512;2 l/ T/ u# r/ e% H9 {+ {
  79. static int bcnt = 8;3 D3 U2 D) ^& }  b: t7 K
  80. static int ccnt = 8;) T  R" c0 R) t8 J
  81. 1 d- ]7 d% N  w: x2 _4 V
  82. module_param(acnt, int, S_IRUGO);
    ! W; Y4 Q) I! ]" X. B
  83. module_param(bcnt, int, S_IRUGO);
    : F$ x2 b' p& O/ w, I0 Z4 Z; C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& Z3 t, A; ?5 {. k/ i4 V/ g4 G3 |
, X+ d* E3 X6 Z- U9 p' O# q8 N: C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y  D0 q( j/ ]8 a8 [# r! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ a+ B% g% x5 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# s% }( s8 [; g+ D" m* U& G, R& s
- S( ^; t; V0 R( C4 x- B0 u

2 l0 E3 Z5 k4 ]9 r$ j) S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 17:01 , Processed in 0.039913 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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