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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( V& s/ U( y9 n1 d1 \9 e5 J" j
  1. [code]EDMA sample test application7 |3 I" e/ O" m) k' H4 F9 Z
  2. /*' i5 y$ j0 m9 `* P& m8 D6 ^
  3. * edma_test.c4 ?$ S% H) `. D9 z% Z
  4. *; Q* c! S/ L! ^/ o- r2 v
  5. * brief  EDMA3 Test Application7 h: {( B% m/ g; m& C
  6. *) Q; n2 ^/ ]. p' T- M
  7. *   This file contains EDMA3 Test code.& o) n1 y! W% y3 `
  8. *
    ; S( o3 z6 l$ o: f# |) Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 {: s- w- I/ d9 K7 P. Z. B9 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 D; r+ G, `2 a' {' x# _
  11. *         TO CHANGE.) z# w+ t4 l" o! R, T
  12. *5 h+ V: `2 w$ @$ I5 h2 x# A" S' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: d. B( Z1 D2 U& C+ Q2 w
  14. *
    - u5 ^( E2 D) U/ G3 X1 n* i
  15. * This program is free software; you can redistribute it and/or$ N% D1 g" y! @5 @: F
  16. * modify it under the terms of the GNU General Public License as
    1 f3 X6 o: k5 U
  17. * published by the Free Software Foundation version 2.9 ]" j+ h5 t& ?$ u2 H% y
  18. *
    8 N" a+ i" U& A; i" k" g3 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* e4 c4 n6 z$ J5 L
  20. * kind, whether express or implied; without even the implied warranty9 R( p& i2 s% E# b4 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! F$ h9 `( O$ y+ G$ c+ ^
  22. * GNU General Public License for more details.
    , W9 y4 A/ _5 j( V/ N( }3 F( _
  23. */
    4 d7 ]! K" ^+ m7 E: z1 [

  24. 3 \: d9 h! U7 @% u
  25. #include <linux/module.h>, D) S4 w( W+ X4 R' n& ^
  26. #include <linux/init.h>
    ' [& t9 B5 Z8 ]
  27. #include <linux/errno.h>- A# @( v' U" a+ v9 V8 Q! ]0 s
  28. #include <linux/types.h>! c4 H7 ]. k: B$ z$ s, ~
  29. #include <linux/interrupt.h>
    : `9 Q. e5 q1 T4 v: T& e: F$ `
  30. #include <asm/io.h>4 F) J# f: Y& E; `# C
  31. #include <linux/moduleparam.h>) C- V0 e# x# M; v; D  \( |
  32. #include <linux/sysctl.h>
    % F( K& p  r; d4 j
  33. #include <linux/mm.h>
    $ f9 o0 {# I3 v
  34. #include <linux/dma-mapping.h>% e7 j* x  L2 U. j  D2 t

  35. 6 C% x8 h6 i' k# w
  36. #include <mach/memory.h>8 a# u1 l3 _% C& d; X7 J, r
  37. #include <mach/hardware.h>; j) ^  ?, [2 q& W
  38. #include <mach/irqs.h>, S3 E$ d# Q5 S+ c& C' f) ]
  39. #include <asm/hardware/edma.h>
    , c0 v3 |6 b) n! l  X7 L
  40. 1 E" V8 ~5 M0 ?7 Q+ s3 U6 p
  41. #undef EDMA3_DEBUG
    ! ]* r- s. N( s& b9 u* q- d
  42. /*#define EDMA3_DEBUG*/  v! J' n- T$ `/ g% b3 H) [$ g0 W
  43. 9 N% R- N9 D7 t6 B; E; S
  44. #ifdef EDMA3_DEBUG( F$ v1 @# z& }/ F5 P5 M) w7 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - c& p; o& V' T8 H' B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " q0 p* Q- ^" i) k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l* s4 [; E/ g+ V* A. h/ v/ p
  48. #else) h! D0 Z  @9 y( R+ |/ B
  49. #define DMA_PRINTK( x... )
    / c% e5 H# ^+ [* d% W9 q
  50. #define DMA_FN_IN' ]9 s1 x3 U3 [. @
  51. #define DMA_FN_OUT
    ' t& X7 S5 l  V% N: Q
  52. #endif6 |- j2 Q& B2 Z% N! o  {
  53. + s; G6 I7 T% F2 ^8 V. q6 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): a+ ]' ~; o' t0 g
  55. #define STATIC_SHIFT                3. j& c; \4 v# ~$ p2 X$ F
  56. #define TCINTEN_SHIFT               20
    : T5 J- Q; s+ O9 U* u
  57. #define ITCINTEN_SHIFT              21
    ; z& k* `8 ]5 b: V. y3 y
  58. #define TCCHEN_SHIFT                22* [0 s, M" r- S. k. i/ Y0 ~
  59. #define ITCCHEN_SHIFT               23
    ! L. t1 g  ~& g' J
  60. ! R0 ~( {0 F/ W
  61. static volatile int irqraised1 = 0;/ [, t. ?7 @* A6 w% {  G& s. e% a
  62. static volatile int irqraised2 = 0;2 H2 g0 C3 G4 a2 N; h' U2 ?

  63. : E# m0 e; Q, J* t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      d1 {! O, k# G; O8 o2 u. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t, U* H# [0 ~8 O  U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u  a' l8 u2 a) R* Z6 t

  67. 1 q3 c0 R: V( {
  68. dma_addr_t dmaphyssrc1 = 0;
    % D- a9 K5 B8 |' {& Q
  69. dma_addr_t dmaphyssrc2 = 0;1 }; E1 q& w2 r) i, p) M8 [' _* ?
  70. dma_addr_t dmaphysdest1 = 0;* f9 D& K, D0 g8 b( G& x9 O. }
  71. dma_addr_t dmaphysdest2 = 0;
    9 Z: D% F. n6 \3 F  C  y& h
  72. + j% h; J, u0 I1 u' M% e  s' P! V: \
  73. char *dmabufsrc1 = NULL;: {; w" T+ ^$ H& h; \' x
  74. char *dmabufsrc2 = NULL;
    6 ^  c1 e! ~6 p( j& T9 j" z. g
  75. char *dmabufdest1 = NULL;4 {6 j* }9 |  _
  76. char *dmabufdest2 = NULL;+ n% b/ d9 ^2 \3 |: g, ^2 ?. O

  77. & K% f$ P- J1 b' q$ @+ A% |
  78. static int acnt = 512;
    4 A5 M' g3 {9 f
  79. static int bcnt = 8;$ f- x9 R6 L  H1 l) Q- j
  80. static int ccnt = 8;
    % J5 m* b5 K9 Q: ^' z8 M$ i

  81. 0 Y% y# L4 Q8 Y4 R$ D0 h
  82. module_param(acnt, int, S_IRUGO);2 T3 w. Y/ q4 J: o* v
  83. module_param(bcnt, int, S_IRUGO);
    4 w$ ]' y% h5 V! Q8 X% _2 u, N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ L! N5 P5 w7 i! `4 X1 G/ M) u: O( H% P
" r8 y0 m' S4 D. J( l7 W0 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; V" i, L$ k2 Karm-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 i: g: }, `+ R+ @( f  s. X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e% h, @6 _5 d$ Z
% K. o! t, d* }( O! O
! K) }& f6 \, r: m5 k# j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 20:19 , Processed in 0.040202 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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