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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x" A& b0 O( _8 u* x) }: z" O  A
  1. [code]EDMA sample test application
    5 V; W7 o6 {' x  i+ Y' O7 M* _3 d
  2. /*
    * R5 i& q% ~% ^3 s7 {
  3. * edma_test.c
    % C2 b+ y* B' d1 E
  4. *
    3 n; d& M$ _+ Z* c% _
  5. * brief  EDMA3 Test Application
    0 \! h' P$ h9 ~+ o4 k4 L
  6. ** q9 ?$ S, W2 C
  7. *   This file contains EDMA3 Test code.* l( l4 t% z/ R* ]
  8. *  ]: A& ~" A) N! V$ w2 |6 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : ?0 p5 g! ~( `* V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W1 o, \# w  X* |. M0 X% `7 z
  11. *         TO CHANGE.* u1 F( j: A6 m5 N
  12. *' l0 C7 _" B3 g' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: @9 ?6 b6 c; j, x
  14. */ p( a! ~. G( F* G2 b2 }+ B' B% w- M
  15. * This program is free software; you can redistribute it and/or! K* S+ R3 H( O
  16. * modify it under the terms of the GNU General Public License as! |1 L4 n0 ?9 m( W& e
  17. * published by the Free Software Foundation version 2.
    $ H) N) J+ i- O1 T( n; R# x
  18. *2 w& q/ d% i* Q) p, p' f& B+ `; `# b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# i# j# T9 X! |' r! r$ O- n
  20. * kind, whether express or implied; without even the implied warranty
    4 y* O' Q. r9 k$ S' Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 {1 W; B) q* f
  22. * GNU General Public License for more details.. h& n" Q6 Y! x+ H8 O8 G
  23. */
    6 T" o: b) V! H0 T5 k
  24. % w0 a3 k! R. L- W/ _& t
  25. #include <linux/module.h>
    7 L3 \: s( k4 p  B
  26. #include <linux/init.h>8 t8 F9 L. r; b! u( n0 Z0 b+ h2 f, N
  27. #include <linux/errno.h>* e" J  U9 i/ _, J+ |- y3 L$ p
  28. #include <linux/types.h>
    1 l, M; ]: L) E; L. X( j( V
  29. #include <linux/interrupt.h>
    . p# J: z* G7 h7 p
  30. #include <asm/io.h>
    . a, f, B6 F1 d  j: p6 q; [; F
  31. #include <linux/moduleparam.h>
    0 D& t4 I' ?& Z! m" L8 n
  32. #include <linux/sysctl.h>/ Q5 o' a% B6 |( a# ~8 M3 W3 L( V1 Z
  33. #include <linux/mm.h>1 U9 j5 a' w9 V5 K2 o( w- G
  34. #include <linux/dma-mapping.h>% @: v( L$ g" e$ c0 i9 R

  35. ( R; ]5 G( o! k7 G
  36. #include <mach/memory.h>
    . z6 c3 V  e/ M6 G
  37. #include <mach/hardware.h>9 j' H# }$ Z  R2 z+ S
  38. #include <mach/irqs.h>5 n2 F2 y+ S& H" N. O6 h# @
  39. #include <asm/hardware/edma.h>2 |: T' [, B  K/ Y3 }$ {8 `, {, W# L
  40. " s7 Y) L1 f, ^. Q) u
  41. #undef EDMA3_DEBUG( v6 _5 k$ Y& @9 m% D
  42. /*#define EDMA3_DEBUG*/
    1 @9 A; Q' _( Y
  43. $ V% _6 \( `# n! U, r2 U; o1 }
  44. #ifdef EDMA3_DEBUG
    : W# Z; g# a# `: H5 c; t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : N9 N2 }3 f+ j3 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - l1 M# k4 V+ m  r- L* U! R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), N. j9 B% e4 \4 \4 P; K
  48. #else5 D* M) G% q/ H  M4 C* J/ J
  49. #define DMA_PRINTK( x... )
    5 o" v6 r% S# z( K' ^
  50. #define DMA_FN_IN
    7 B8 |: C+ Q5 \# r1 w
  51. #define DMA_FN_OUT: V% u( h1 c; b/ b
  52. #endif+ F& y! E9 \( g% X' p

  53. 7 R* W6 v0 ?/ y& a4 U! M8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , ]# V3 G* A: P6 |6 Q" ~
  55. #define STATIC_SHIFT                3- Q* T: f! b% |, P7 C
  56. #define TCINTEN_SHIFT               20  v9 }- n6 t+ G$ H( `
  57. #define ITCINTEN_SHIFT              21
    9 k" M" c) e& S) y1 D& ?& a% s' F
  58. #define TCCHEN_SHIFT                22
    5 x3 n& u0 U6 L! L' s
  59. #define ITCCHEN_SHIFT               23+ b4 }+ O9 H. `) O
  60. 4 V* m8 b2 h: Q3 |. M0 l6 N
  61. static volatile int irqraised1 = 0;
    - T& z1 d  B0 l; d
  62. static volatile int irqraised2 = 0;
    1 r- D- h/ t7 N: K

  63. 2 e: V1 M' k% D0 m4 i2 J7 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g) q) r$ [/ P  v; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % u2 Q7 U' B  \5 q6 Z2 b3 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K" p, j3 d" C
  67. " U2 I8 j/ R. _0 W/ S& B$ v2 N; P
  68. dma_addr_t dmaphyssrc1 = 0;: S! z' ]+ w# C
  69. dma_addr_t dmaphyssrc2 = 0;7 t, g8 P5 `: Q4 {, z, A
  70. dma_addr_t dmaphysdest1 = 0;
    ! D: U3 y: c, P& @# f
  71. dma_addr_t dmaphysdest2 = 0;$ X, `8 U9 n) e; U. }" j1 f# q

  72. " p& t2 R9 t* I* \
  73. char *dmabufsrc1 = NULL;
    ) B) g3 j' ~- ~+ M" r4 f
  74. char *dmabufsrc2 = NULL;( p6 b5 E# z( |5 T
  75. char *dmabufdest1 = NULL;
    1 E5 w8 W  F# N
  76. char *dmabufdest2 = NULL;6 i1 {" n/ S7 ~% v6 f: R
  77. . L; C3 Q1 a+ O: c
  78. static int acnt = 512;
    ' _- P  r; q( k7 c
  79. static int bcnt = 8;2 x$ s" b0 D) `& V! S, l3 W- x# }
  80. static int ccnt = 8;% P) s+ z* p9 x! j# L3 {

  81. 4 R9 S8 @5 Y  O; d: ]* m2 T
  82. module_param(acnt, int, S_IRUGO);
    2 O: ~$ A5 P/ Q/ V
  83. module_param(bcnt, int, S_IRUGO);( ^% k$ g7 X& E3 c. {. W- C6 K0 d* i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% Z% q& d. c  o2 ]

, b4 K: p& v4 r2 g8 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 R6 f- n; \; K( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G$ Z# ^  k( ]9 q" m4 w+ |" ?! t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 u' C+ E5 Z1 y; v9 }7 `% m/ X

) a7 b  o, \4 z' f; a, C* P8 \* c. s  Y$ N6 c8 g" W3 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 17:32 , Processed in 0.052668 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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