OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * N1 p8 i9 m; A- _5 j4 U+ N$ m1 D
  1. [code]EDMA sample test application- B& c8 k7 i9 a& v$ y9 E3 G. d& j* w
  2. /*
    8 E! L- g  }. `! m  U2 E
  3. * edma_test.c$ W7 P" T9 ]8 V6 L4 L/ U6 V7 d
  4. *) j. p  U# m+ _- [( v# k/ w) i
  5. * brief  EDMA3 Test Application! _* N* n- g- J
  6. *. y/ D5 p! m/ f* C8 s; x5 K. q
  7. *   This file contains EDMA3 Test code.
    7 Y) v) u2 @2 G
  8. *
    - F: n- w, x' P% [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 D8 L/ Q8 S- h9 ?- Q# @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # \( e7 K; v3 d; B: ]. V( Q
  11. *         TO CHANGE.
    + {! O$ d2 h$ R1 L: X
  12. *" Q5 B. y  G$ B$ `3 \# ~: X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 v8 @0 i* c5 R2 V* P6 Z8 U
  14. *
    " M7 S- l& j9 ^+ Z0 V2 s+ h
  15. * This program is free software; you can redistribute it and/or
    . [) @' l. h4 u; s5 B. \; q# U
  16. * modify it under the terms of the GNU General Public License as9 _4 L1 t, G3 m( Y( Z( S) X
  17. * published by the Free Software Foundation version 2.- G1 O1 o' T" }
  18. *
    ( c+ R# i, |7 h: X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 G, K7 y1 }( p$ G1 t" l
  20. * kind, whether express or implied; without even the implied warranty
    , T( D# d' C. y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : D( r+ X& V2 q, o5 |5 y! `: E
  22. * GNU General Public License for more details.
    4 b0 h) v% Y9 `
  23. */
    / K7 d7 c0 w" X5 d9 I, w8 u

  24. + L6 h3 \7 u( I3 b5 I" |9 r
  25. #include <linux/module.h>
    2 y* v8 I  q& A7 V
  26. #include <linux/init.h>
    0 O# V4 B: |+ _, C5 A
  27. #include <linux/errno.h>
    ! _( h7 |0 N/ U% X% f) Y
  28. #include <linux/types.h>
    " R: D& N8 u' t, C5 q
  29. #include <linux/interrupt.h>
    , C9 f/ K! R1 Y2 T
  30. #include <asm/io.h>
    5 c' Y9 m, E( h5 m
  31. #include <linux/moduleparam.h>- f- c2 x( i: p$ ?1 z4 G# ^1 H  s
  32. #include <linux/sysctl.h>
    , \) w2 {. k8 C' Z' z8 J
  33. #include <linux/mm.h>9 u+ v9 I- u( b( T* G) @
  34. #include <linux/dma-mapping.h>
    8 s/ J+ T4 V! \

  35. - q% ]% h% F. y6 I$ D2 R! ]9 X
  36. #include <mach/memory.h># E7 {% Q+ R$ B/ E2 |/ k% S) j& p
  37. #include <mach/hardware.h># W6 {9 o1 P. H: ^1 n# c
  38. #include <mach/irqs.h>
    & O5 \" |! Y9 i7 P
  39. #include <asm/hardware/edma.h>  x( Z4 d  _1 N9 t: c2 c/ R3 l
  40. 4 [. x1 [$ x5 z: F' \
  41. #undef EDMA3_DEBUG. U: B/ E- k  Z/ X* m4 S, b! X
  42. /*#define EDMA3_DEBUG*/
    : M+ s2 B7 J: {+ ]; U( |& r
  43. - L+ X; X! U% ?3 m* R
  44. #ifdef EDMA3_DEBUG( |4 I+ J% p; |8 y* U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & }/ s( B$ Z% e- p1 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / W$ \) D/ z1 _& V/ ]% }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 {) `$ Q  N. T3 z3 A) H+ w
  48. #else; K& v0 i7 o8 Q
  49. #define DMA_PRINTK( x... )3 f7 {; K+ l0 Z* b7 K
  50. #define DMA_FN_IN* Z0 A' y6 S- I% ?+ D& n3 J
  51. #define DMA_FN_OUT  d. {7 H& [9 s4 X' s* x
  52. #endif
    2 D. l5 t9 U/ E; b# V
  53. - {& t8 ^1 s. Y$ t( M: P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 W# Z6 j9 l- F( n; a
  55. #define STATIC_SHIFT                3
    6 g; m8 o, t9 \! K% `
  56. #define TCINTEN_SHIFT               20
    5 \9 A$ R5 Q1 J: h! W+ F
  57. #define ITCINTEN_SHIFT              215 z- d# N' D  u' L3 v3 ^( U
  58. #define TCCHEN_SHIFT                22; H) w- q/ u7 X' U" j! Z
  59. #define ITCCHEN_SHIFT               238 x( S: R7 `9 y" c5 L6 y
  60.   \6 P' K; a7 V" g8 U
  61. static volatile int irqraised1 = 0;& Q: p6 R5 q$ ]& a  e$ ?
  62. static volatile int irqraised2 = 0;
    * Q) o' n" k2 d5 I

  63. - v& A  k* ~: J! _* r4 M8 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 s5 T1 B; B) U' M) L9 k8 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . R* @. U1 o0 E1 E: F$ `( i$ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " z8 }0 P, a! c! r
  67. ) O. m# d0 j; e1 [, f8 ]6 U
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Q8 b0 B+ h  b+ d
  69. dma_addr_t dmaphyssrc2 = 0;! H: w/ D) G( b, E/ y
  70. dma_addr_t dmaphysdest1 = 0;
    + s  k. J+ {6 t# k
  71. dma_addr_t dmaphysdest2 = 0;9 I0 Z; z  P$ y. c; H: Y
  72. ; F6 @( O! @5 ^  g
  73. char *dmabufsrc1 = NULL;
    6 Q& O! x: {, O3 h1 ]" y+ ?4 G' _0 v
  74. char *dmabufsrc2 = NULL;
    9 z% N; N' i. }/ C8 M6 d% S8 J
  75. char *dmabufdest1 = NULL;9 U! u% Q, K- v  [
  76. char *dmabufdest2 = NULL;7 O$ j' O6 w% l: B( ^
  77. $ O1 w/ R# P, y4 i
  78. static int acnt = 512;
    " H% S8 J9 N" @8 f- c
  79. static int bcnt = 8;# a* W9 ?& g. `: \( n2 w
  80. static int ccnt = 8;7 P8 ?/ I8 d9 I2 i' v" `# M# S4 Q) @
  81. * o/ q. V( K1 E
  82. module_param(acnt, int, S_IRUGO);' ?$ `1 b4 c. o; t1 K& A3 m
  83. module_param(bcnt, int, S_IRUGO);, e& ~3 ^" b! P+ h; k/ K6 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: I6 G! V( Z0 E6 [: s1 e0 Z/ W# T6 ^$ ]9 ~% `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" r& q  g- D5 P# q+ marm-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 P! e0 |9 s3 j) t& W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( }4 H& P, Q# E( }
8 Q  R0 A6 }1 \; N% f; W$ [) ?& b

1 c; `% D0 I4 z  y1 B2 M8 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 09:45 , Processed in 0.037080 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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