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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; V: {$ _% x$ u, r1 c8 Q9 f- Z; T: _
  1. [code]EDMA sample test application) E4 ]: \. Q! N+ o/ J8 \+ ^! _& Y5 y
  2. /*& z" e7 k1 w  i9 R$ c6 M
  3. * edma_test.c& z  r, h8 l# N: O1 l5 M5 y
  4. *
    8 q$ q1 K  E* U1 H1 P
  5. * brief  EDMA3 Test Application
    , m& @% C+ b8 r) _- e' e* e5 |
  6. *% d3 E0 X( g6 N( r) I
  7. *   This file contains EDMA3 Test code.5 \2 l9 j( @3 X
  8. *0 w+ F( W# S& I+ W4 S( w, M& P* @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      H" s& e9 Y& p+ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : c* G+ a$ k  s% Z/ g  T
  11. *         TO CHANGE.: t' I( x% f( u0 j8 C5 i3 e: R
  12. *
    ' y9 h! B" K. B2 h' [, Q0 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: i" x, \, B! M' Q/ `7 @
  14. *
    5 [; }+ g/ I0 K3 B9 x
  15. * This program is free software; you can redistribute it and/or  t/ ~% m  H/ D9 |# h+ \' M
  16. * modify it under the terms of the GNU General Public License as
    : l, G$ X8 P' J9 B5 j/ n, _
  17. * published by the Free Software Foundation version 2.* z# T8 {: g! s
  18. *9 ^3 u" ^7 ^' M4 f0 q  H7 _# r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 m1 ]" g  g/ {" m( v4 u
  20. * kind, whether express or implied; without even the implied warranty/ b- ]) }$ R$ ~5 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 P* z) Y4 k+ g, w0 j
  22. * GNU General Public License for more details.2 x% N; ~+ E' w" R/ `6 I
  23. */, L( h; v* E8 S# w4 x. a
  24. ; t4 C; v9 L9 X$ j5 H* ]1 M* b1 O
  25. #include <linux/module.h>
    ! K4 p, N) ]& _# p( f, v0 t
  26. #include <linux/init.h>9 R0 j' H9 z3 C5 V9 U
  27. #include <linux/errno.h>
    : S$ n  h! C! u; `( `7 |) s. s
  28. #include <linux/types.h>1 E: L- k( n: ^/ b1 C" y9 D. ~
  29. #include <linux/interrupt.h>; @" C2 T: z1 x& y% ^
  30. #include <asm/io.h>3 U) B1 {9 w6 c, r3 s- s2 l3 ~4 j2 v
  31. #include <linux/moduleparam.h>/ r" j. H0 Q1 A& W) F
  32. #include <linux/sysctl.h>5 a$ a; s* O9 o# t; ^
  33. #include <linux/mm.h>
    ! ?- |% X6 i4 `- Q0 d7 s
  34. #include <linux/dma-mapping.h>; O6 k/ G& B; R% c
  35. 5 _/ h' m7 d: Q/ V2 _, i
  36. #include <mach/memory.h>, D2 @( m) Q1 e- y6 ^
  37. #include <mach/hardware.h>
    # [8 O7 z# i* U# ^6 E
  38. #include <mach/irqs.h>
    3 j* p* C+ o1 l5 y* i- b: r
  39. #include <asm/hardware/edma.h>
    . q* f6 f- `. o4 F
  40. 3 w1 R" a* d, m, b( o% C8 U7 s" V
  41. #undef EDMA3_DEBUG6 ~6 y. L8 c  d' Q% `
  42. /*#define EDMA3_DEBUG*/6 t# W4 V# |' O% P' m# C

  43. ) x1 Q9 ?5 z3 ?
  44. #ifdef EDMA3_DEBUG6 W- _1 v8 a/ g5 t3 P& J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ V+ y& r- f8 M' h! \( d, \+ z) Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; e* X5 X1 z  _  J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% @, d; u- A7 L8 Y; H
  48. #else
    9 P- W/ x+ g7 z: s' i5 E2 ~# S, V
  49. #define DMA_PRINTK( x... )2 j* F- k  p0 k6 S" Q4 B
  50. #define DMA_FN_IN6 z# e( J. u. l) Z
  51. #define DMA_FN_OUT
    1 X+ F0 o9 [' f6 K+ r7 A/ L
  52. #endif
    4 f: L- i0 F: t8 R* I3 v) G

  53. ; x5 o2 h- f# z. m, M% k6 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 t5 S( }" I. O+ U0 x! ~
  55. #define STATIC_SHIFT                3# f0 n/ {- d; F! M( U8 n
  56. #define TCINTEN_SHIFT               20! p8 [4 B$ L& q/ g( J/ I. K8 U
  57. #define ITCINTEN_SHIFT              21( m* `% p) N1 T; _& `
  58. #define TCCHEN_SHIFT                22; g  V- q+ q, W1 p/ b
  59. #define ITCCHEN_SHIFT               23# e9 e2 K5 i' m/ f/ }4 X  s
  60. 7 ]0 ~6 K: n4 `% o
  61. static volatile int irqraised1 = 0;, g% Y: p( J4 }: s; k
  62. static volatile int irqraised2 = 0;
    + ^6 S' Y+ Z. i+ |5 v
  63. # v" }" j! g8 e/ l( D7 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S2 ]0 l. y; h( J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {9 {4 D+ x) Z: W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; q$ E1 h8 X# Y7 F( Q

  67. ; r! @! N# F: r- R- K$ K( r
  68. dma_addr_t dmaphyssrc1 = 0;" V# G1 S( @4 K- c/ }1 }
  69. dma_addr_t dmaphyssrc2 = 0;
    7 M; c' [5 ^3 |2 }7 K, n* A
  70. dma_addr_t dmaphysdest1 = 0;: a/ O4 T, y: P7 ]& S, `$ _5 N6 D
  71. dma_addr_t dmaphysdest2 = 0;7 Z4 w. D! w1 _1 h. W# m7 d
  72. 3 x! {/ R  u: B
  73. char *dmabufsrc1 = NULL;" j  a' {" e: Z0 U& {% h
  74. char *dmabufsrc2 = NULL;! D2 `' A. m8 K) x
  75. char *dmabufdest1 = NULL;- y7 x. Y2 V3 K7 ^3 q- ~7 j
  76. char *dmabufdest2 = NULL;$ _: ?8 ]: t2 ^; W

  77. 5 b1 R! s- i0 N% @1 U' A
  78. static int acnt = 512;
    + y; k$ f9 I5 _" \, h
  79. static int bcnt = 8;3 r2 e0 H8 }& a* j, Z2 B1 H
  80. static int ccnt = 8;3 B$ E2 ~0 i( b# ?; m- x' l  b
  81. 5 n2 z+ t. Z  r3 n# S, Z1 L
  82. module_param(acnt, int, S_IRUGO);5 P1 C% S- E$ U8 a. n3 P' G
  83. module_param(bcnt, int, S_IRUGO);
    ' y! m* n4 k+ p! n6 y% o' M% D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ {1 _; Z0 B3 I3 [. G0 C

0 ~3 ?4 x5 f1 D5 N  t' k, e; Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 l; b6 {9 f3 }0 m% z3 S4 b5 E$ F, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 {& y) T. |: i0 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _  F6 i& S  u6 ~. M4 w& c& W4 A
8 X0 o* `" V, b' a

& L* K3 a# J- e3 N" b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 05:55 , Processed in 0.038256 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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