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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) n5 h* p' x" O9 L& n
  1. [code]EDMA sample test application
    # z0 S6 ?3 w; c  C5 U
  2. /*
    1 j/ r, i2 _' U) ^
  3. * edma_test.c
    5 `- j  C0 o+ O  b$ M: I
  4. *
    ( ^9 u( N7 k7 E% v9 d" A: r/ y$ r
  5. * brief  EDMA3 Test Application: k" C# F$ Y; I$ v" {. O% o
  6. *
    7 B4 b0 |$ _' ?1 y' G1 A: G0 O
  7. *   This file contains EDMA3 Test code.
    8 Q# s7 M, S0 ?. E  s4 h
  8. *
    3 L+ Y# ]  a: b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) t, @  [! M8 |" _) @6 D/ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ M8 A/ Z. S. ~, f4 S' j& i
  11. *         TO CHANGE.9 [% s: T! o; P' f$ I
  12. *8 M4 L# T$ V; S/ L8 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ?/ g4 @: o, p9 s# z, W' X/ l
  14. *
    6 C# ?. }; X+ v" G. E
  15. * This program is free software; you can redistribute it and/or
    # w6 H" d) |+ {1 w9 K
  16. * modify it under the terms of the GNU General Public License as
    % ^! @! t8 d" h9 q, o: _( [
  17. * published by the Free Software Foundation version 2.
    - [- \" ^/ H7 n
  18. *2 z+ d6 N" H  w  K+ _0 H* P+ G" r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; }( ~% f5 _" J; L( t% A+ k: V  @
  20. * kind, whether express or implied; without even the implied warranty
      l- j3 `# @/ ]; B! G& G9 [9 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : e4 Z: D# `- S3 I! D
  22. * GNU General Public License for more details.1 n9 d. B- I5 ~& N' w
  23. */
    ; {0 s. m2 z( X8 I

  24. : [/ ?+ I' p0 ?( i6 t
  25. #include <linux/module.h>
    ; s' k# O# ^* Y9 Y0 ]- t$ a
  26. #include <linux/init.h>
    # d7 f4 g! h" b- V. y
  27. #include <linux/errno.h>7 @$ A3 P* d/ B: }
  28. #include <linux/types.h>
    " C7 d( n" U2 k
  29. #include <linux/interrupt.h>
    4 ?1 [/ r' f7 p/ K. c
  30. #include <asm/io.h>
    5 U' k, f* Q, h% k" b: F9 h) J( B- \0 i9 O
  31. #include <linux/moduleparam.h>1 b& e  U2 t+ G* D! g* D! N
  32. #include <linux/sysctl.h>1 z. I  v+ M' \+ u* b; e
  33. #include <linux/mm.h>$ ?7 @1 h8 W) C3 S
  34. #include <linux/dma-mapping.h>
    ' p) v- G" F5 g" j

  35. 5 m6 d7 V& F) W- Y1 ]  u8 M! F
  36. #include <mach/memory.h>
    " }! T! Z- F; V& g9 }
  37. #include <mach/hardware.h>
    9 d% r$ q( f) H2 C: j9 @, B0 f
  38. #include <mach/irqs.h>
    4 _' ~. G3 U% I% a. |
  39. #include <asm/hardware/edma.h>
    ) ^) z4 a% {. {. P

  40. : P3 r; N1 H" Z
  41. #undef EDMA3_DEBUG% H" E( h; `0 z3 O: X% p  q
  42. /*#define EDMA3_DEBUG*/5 `5 F6 G( R0 O3 h: ~/ _" X( j' G
  43. 0 ?! u1 }$ \; Z5 G% |  O
  44. #ifdef EDMA3_DEBUG
    ) R8 ]6 M% o7 O+ U6 J& ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 G. t$ Q8 l" ?0 A" Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). C3 q. V5 N( @+ [5 w2 m  X( z  S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- r0 s; r% _/ d" t# u( D7 s* y, c
  48. #else
    / N! C+ Q6 S3 u
  49. #define DMA_PRINTK( x... )
    ! s* [  o4 S) G* S4 H
  50. #define DMA_FN_IN- d9 @! r# p' ^8 I8 ~
  51. #define DMA_FN_OUT
    3 X6 H8 g2 Q2 S* I9 v* G
  52. #endif
    3 K/ s$ f: ?9 v( E4 ?) G! M
  53. ! _& O$ B. o# w, R$ ~( Q# s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ W- `; C0 B/ N4 G# r' B' X/ l/ k
  55. #define STATIC_SHIFT                3# v1 ^# @( k8 t. t
  56. #define TCINTEN_SHIFT               20
    5 c. n- ]/ z, u6 T$ J- E3 n
  57. #define ITCINTEN_SHIFT              21' h4 K! a4 O. m4 J0 j/ q' Z
  58. #define TCCHEN_SHIFT                22" z, p0 k# Y6 r! I* g5 ]
  59. #define ITCCHEN_SHIFT               230 d6 z! o5 k; g

  60. # ~4 e2 X6 Y/ }* D& u* R
  61. static volatile int irqraised1 = 0;: u5 j; L* q2 ?! L# F, l' H  D
  62. static volatile int irqraised2 = 0;" o2 [6 t# T& Z2 Z

  63. 4 b/ \+ ~$ x6 j2 Q; J. k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 t( p1 F3 H# a9 P& Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 o- h' i% M' \* V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A; V0 S, ^( G( l2 N- }
  67. 2 F4 Z; }8 L) V1 B6 H' X5 _0 z
  68. dma_addr_t dmaphyssrc1 = 0;9 x" T+ ?" U1 R3 c
  69. dma_addr_t dmaphyssrc2 = 0;
    4 ?# g  ]- f2 j3 M& a
  70. dma_addr_t dmaphysdest1 = 0;  U* P5 ~, x9 n6 L3 \3 S7 n
  71. dma_addr_t dmaphysdest2 = 0;
    + E$ w9 m' n# f4 w  N) A' d

  72. * K/ R0 j$ l/ Z( }6 E$ e; R
  73. char *dmabufsrc1 = NULL;! q- f5 O* r- o, S- X1 B  l$ i- Y
  74. char *dmabufsrc2 = NULL;
    ' h# _% V9 h# d) y) ^7 _) g
  75. char *dmabufdest1 = NULL;
    + f! q* E2 N6 o  u# H
  76. char *dmabufdest2 = NULL;
    0 Y8 J- P% u) i" n( W) ]' S) R

  77. : Y$ ^2 B: a" G- U5 N
  78. static int acnt = 512;
    1 k) [: u( `4 e* m9 g
  79. static int bcnt = 8;
    2 T9 K5 g0 e; r- E8 q7 V8 a
  80. static int ccnt = 8;! Q, _% e6 T4 j  g5 @% [" I6 S
  81. , |* O! K2 s  Z/ \7 `
  82. module_param(acnt, int, S_IRUGO);
    2 B. {9 f$ u+ P" f9 L8 ^, f
  83. module_param(bcnt, int, S_IRUGO);0 l8 R- o2 J$ i$ O+ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 ^4 N* y# R4 i" y. M
9 p! k7 k8 ~  u$ v" i* a" F& I+ n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 c8 e9 X( e) d% carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* O% l0 `, k$ r/ C+ j1 f  X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 o$ S8 l: ]( u5 O6 P
: l! {6 d. [$ h# r1 d1 p+ c% j( t: r9 R+ Q' g/ V2 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 01:35 , Processed in 0.043399 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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