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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j* p% v3 w( P3 S
  1. [code]EDMA sample test application
    . Q/ V6 W" L, V( ~
  2. /*4 s8 N% ?+ ?1 E7 z  p3 J/ Q( A. J0 B; {
  3. * edma_test.c- ^! D- B3 t& i& ^( P8 H
  4. *+ K9 \/ Z+ q  }# G. m
  5. * brief  EDMA3 Test Application0 V2 E2 b& r+ o( v
  6. *" g! G6 i% k: |7 T5 c0 P
  7. *   This file contains EDMA3 Test code.
    , B  \/ z% ~# U3 D3 j* X
  8. *
    6 V0 o$ z# a2 l" W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! t# L# L3 h4 k! P: c% @8 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 }- i) m* P2 r3 e( S3 D# j
  11. *         TO CHANGE., G0 w7 A  ~: u) h# w: h; o
  12. *2 M" h& E/ Q; w/ C7 R  A, D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# K" q) @' G' n2 v1 p' f  ~7 _/ @
  14. *
    . r; q8 ], E- e6 Q: c9 n2 C5 C% c0 y
  15. * This program is free software; you can redistribute it and/or  c2 ]9 k) q' s. m( ]# z5 q2 G! ~
  16. * modify it under the terms of the GNU General Public License as
    ; r! F* L# |: b6 K3 q
  17. * published by the Free Software Foundation version 2.
    ( \+ W% b! q. V0 V& H
  18. *
    7 l" w, e1 q; J1 @  L" K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 K& U' G, m, H2 e
  20. * kind, whether express or implied; without even the implied warranty' _6 j- ]# m4 w  Y1 `5 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# _5 A7 o9 U+ V& O  G$ S# e+ l1 ]% h
  22. * GNU General Public License for more details.0 l5 d- |0 ?1 o/ x
  23. */
    ) z$ u% [3 y  M$ h: O  R
  24. 8 C. I( G/ m. b& g
  25. #include <linux/module.h>; g, I% s2 @9 s6 j9 ?2 ~- m* S
  26. #include <linux/init.h>
    1 }" T6 p7 a! E% X
  27. #include <linux/errno.h>+ M, t6 E( l% K0 V% y
  28. #include <linux/types.h>+ `  T( B% W( S* X
  29. #include <linux/interrupt.h>
    " \4 t  g6 p1 S" B5 G* `
  30. #include <asm/io.h>
    # Y! h- X/ x! Z+ A2 _* V# A
  31. #include <linux/moduleparam.h>
    % z& N# `# [5 m5 M, n; S6 H' W: ?
  32. #include <linux/sysctl.h># E8 j% z8 y$ H6 r4 Z4 K
  33. #include <linux/mm.h>
    & Z( ]( V  e* ]! I. B& N3 l8 w) Q
  34. #include <linux/dma-mapping.h>3 O- t5 z; |0 p( @
  35. # |/ q/ L: P, g  G4 Q# J2 D
  36. #include <mach/memory.h>
    / Z* n  B8 ^, n3 z9 A/ U
  37. #include <mach/hardware.h>9 t4 x3 l  m6 \4 A4 f0 P- A
  38. #include <mach/irqs.h>
    & V5 P5 k9 E8 _- H  u  g# {
  39. #include <asm/hardware/edma.h>
    " {7 T. ]/ W. |8 }( }; D* ]

  40. & o* w+ `  ]# a3 q& V# V
  41. #undef EDMA3_DEBUG" Q' F+ u# o/ U' ?
  42. /*#define EDMA3_DEBUG*/- I7 o) Q/ m4 a5 q" z/ Y* L. h6 w0 C

  43. ; c1 r5 [! S8 E0 h2 a
  44. #ifdef EDMA3_DEBUG6 W5 |7 P- t" s8 n% o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! |+ b1 J" N# g) @% T- Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * R: _9 V% B0 K3 }# F- b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 M4 o2 G0 l  H6 k! N- d% q
  48. #else
    - o' N0 U6 ?4 F7 t% e5 f; a; }2 c( q+ s
  49. #define DMA_PRINTK( x... )
    ' N' D0 e' S* D$ C8 K
  50. #define DMA_FN_IN, a6 N/ h, C8 I! `4 Y, X5 ]2 J
  51. #define DMA_FN_OUT5 V3 E# z% Z) T) H- v- o( F
  52. #endif
    ! ~) t- A3 `0 x) }; F9 |
  53. , A4 k/ f8 f. N! O2 \2 E; ?; ^0 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 |1 Y+ `! h1 u2 J6 ~; U
  55. #define STATIC_SHIFT                3/ w" R1 S/ w) ?/ |' }, W; D( D; h
  56. #define TCINTEN_SHIFT               207 i- O6 M0 J5 j3 p; x8 U/ y) y
  57. #define ITCINTEN_SHIFT              21
    0 i$ F! {" r, X/ O" [! l
  58. #define TCCHEN_SHIFT                22
    # W0 u! Z5 m+ I6 }
  59. #define ITCCHEN_SHIFT               23
    9 V. B5 W6 j+ D& ~8 i) e+ D
  60. 5 ^: R; r4 r2 D- q5 ]. q# d
  61. static volatile int irqraised1 = 0;6 U2 Q+ f1 o  E+ t
  62. static volatile int irqraised2 = 0;0 }4 f1 S$ W! _# }  L

  63. & ]+ V* k9 s- y9 E1 x' c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ~5 z! o% ~6 I7 c/ `. f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A1 X2 ]' i2 V1 z% T* D( ~% f) C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # I( X3 |" I2 J5 h
  67. % g% |! @9 H/ Z
  68. dma_addr_t dmaphyssrc1 = 0;) \4 P& S6 K  n4 _: D- C0 j
  69. dma_addr_t dmaphyssrc2 = 0;) K: V; ]1 W) C, Q' v2 f* y
  70. dma_addr_t dmaphysdest1 = 0;) D4 @3 O0 q* b$ M; R
  71. dma_addr_t dmaphysdest2 = 0;; C/ }. c, o& q

  72. / X$ S' `+ c+ U' x. c8 G4 m
  73. char *dmabufsrc1 = NULL;
    5 G' E* A% E: X: m% k
  74. char *dmabufsrc2 = NULL;. a/ {6 E9 R! I
  75. char *dmabufdest1 = NULL;
    / T% v! b  V' D
  76. char *dmabufdest2 = NULL;
    , a5 ~3 f: l* Y: x
  77. - M. i/ s% \, ~, e0 E' `$ o8 @
  78. static int acnt = 512;9 ?. T5 w2 F5 ^) B
  79. static int bcnt = 8;
    9 ^/ k6 e" |7 d) B8 I0 R
  80. static int ccnt = 8;
    . s( ^3 p* @' i! [# H4 @
  81. 4 |" m$ w5 K# G+ B# L/ B
  82. module_param(acnt, int, S_IRUGO);2 s4 l8 U3 Y8 W% c
  83. module_param(bcnt, int, S_IRUGO);
    ! C* x4 p# J! _% E$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: A$ U- Q/ l0 o* b, q) S
7 f) v9 S8 N, g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# J' D& e+ I- y+ |1 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; c3 S  C' t* Z  d+ k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& V: l& j& |$ }. S) i# m
9 a- a4 T' T' M" y' k

1 w0 J" r1 s0 U8 p# w; Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 18:24 , Processed in 0.041545 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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