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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C, e4 |# e- Y" n0 x$ J
  1. [code]EDMA sample test application$ M5 |# }4 m) Z; B
  2. /*
    ; d' p& K4 ^& @. S) h
  3. * edma_test.c1 ~. ^0 W6 F$ X0 \. V3 V0 a. W
  4. *+ P* M( G. V! L' Q) Z
  5. * brief  EDMA3 Test Application
    ; x$ j  G- C/ ~% ?( n
  6. *
    " q/ P0 {9 V+ j# g: T* t
  7. *   This file contains EDMA3 Test code.
    4 i& l, w* o7 B3 U% t
  8. *& I- Q+ u. }) P* Z9 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h4 a" ?7 b8 Q0 G( d, G8 I; n, a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 s- j3 X, r6 r! E
  11. *         TO CHANGE.
    8 _0 B/ p8 B* X9 u% I
  12. *7 C3 Q: R( \; h1 B  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a2 [+ K7 E; \- k  ]4 c
  14. *: m7 `* Y8 D' U* Z7 r( Z
  15. * This program is free software; you can redistribute it and/or8 H6 u% q; ?, I+ U4 i2 v) I
  16. * modify it under the terms of the GNU General Public License as
    * X  y0 n  u3 u6 E  J* J: d) I/ E
  17. * published by the Free Software Foundation version 2.! C" X4 b" q4 V6 l$ }0 o
  18. *1 l7 R0 y: B7 I0 E! J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & B% R! q+ a( F! U
  20. * kind, whether express or implied; without even the implied warranty, J& H& U% z+ D6 v; }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ o( b3 S6 X8 U( y5 W' [' H3 O: B
  22. * GNU General Public License for more details.
    9 a0 j/ k' ~0 M! V
  23. */) N& a) r( a+ ~5 B) n5 w# |

  24. ' s1 z' `/ t& r7 u; a/ j
  25. #include <linux/module.h>) s6 ?# @9 r( B6 G4 h. t! j
  26. #include <linux/init.h>% p; }1 I; S* a- j) N
  27. #include <linux/errno.h>2 K6 d  ]7 \9 y7 \# j! A
  28. #include <linux/types.h>" C2 E' v3 |/ C9 c
  29. #include <linux/interrupt.h>+ }3 n; a0 D0 n+ r
  30. #include <asm/io.h>
    , E9 e9 P  T& {
  31. #include <linux/moduleparam.h>: L- |+ G" L2 o& F5 I  l2 L
  32. #include <linux/sysctl.h>6 }2 ]$ ]3 k# y" [8 I
  33. #include <linux/mm.h>. s; e7 |: l8 n2 ?4 \/ c2 m' C
  34. #include <linux/dma-mapping.h>
    * t% f! L3 E/ L
  35. : G$ ]( M8 }" @2 d2 n& Q6 Y  o
  36. #include <mach/memory.h>7 t: i& `! J) ~, _1 g' K9 X! ]
  37. #include <mach/hardware.h>
    ' I7 \; Q! H0 n2 ?
  38. #include <mach/irqs.h>
    ; j/ L) ]3 h% M6 a, Y0 f7 \# m/ f
  39. #include <asm/hardware/edma.h>
    ( x: |4 N! u  R$ `" X5 q) D

  40. 2 Q5 @  L  {$ C$ e! S
  41. #undef EDMA3_DEBUG4 d+ C5 C# c; V  V' E6 \9 p
  42. /*#define EDMA3_DEBUG*/. z# Y) e# L* ~/ B
  43. ( n- ^+ S0 O& Y! k5 ?6 Z' m8 c
  44. #ifdef EDMA3_DEBUG
    9 g+ ~5 q( h: W" g' j% r% c1 h9 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); i" e$ d: G! j$ y2 S  q/ Z! T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u2 t$ T) `; {0 t& Q* e6 n0 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ W, R( k$ T! z+ j& i* s
  48. #else; y+ b$ T8 ^2 o& O
  49. #define DMA_PRINTK( x... )% a( V# V, `" k4 h3 Y. ]% k, z
  50. #define DMA_FN_IN
    & W& [; l1 f9 {- B7 u6 X. z
  51. #define DMA_FN_OUT
    " g7 p5 l4 Z% w# @# `
  52. #endif
    # `! D4 i$ B  {& y$ f& b
  53. , Y8 S& d' `( Z1 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 y1 z1 o* T9 k4 Z( k$ F+ Y
  55. #define STATIC_SHIFT                3
    1 B8 ?/ _/ H5 d
  56. #define TCINTEN_SHIFT               20
    + u% B! ^" W7 q4 j5 q6 {9 _
  57. #define ITCINTEN_SHIFT              21
    - Y5 o- Z+ T1 B' B2 }: I7 ?; M/ t, g
  58. #define TCCHEN_SHIFT                224 X0 ]7 w. ^1 X3 }9 L! }' C: Z) u
  59. #define ITCCHEN_SHIFT               23; \. j) _* y0 T# |% T5 A% {2 {
  60. 2 r7 V- I% T2 r9 {) e  h2 p
  61. static volatile int irqraised1 = 0;
    3 L1 E! M5 _8 b4 H  r. i
  62. static volatile int irqraised2 = 0;: P- t8 s/ a2 r7 N" i, O0 \, k

  63. 5 d  a& g1 T" }! H0 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z7 }  k% y+ v1 x* M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q0 g% P- G% L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y0 l! n2 C* k( n/ K2 {! `

  67. . Y. e1 i/ `) K% x2 s% }, g4 h, K
  68. dma_addr_t dmaphyssrc1 = 0;, s$ g- C. O7 m  f1 |+ v  q
  69. dma_addr_t dmaphyssrc2 = 0;+ d1 k5 Y- a+ A$ S5 D1 a" D$ ?
  70. dma_addr_t dmaphysdest1 = 0;
    * m. R# B  n8 e: o& e& O
  71. dma_addr_t dmaphysdest2 = 0;
    3 i( Z5 h  G1 A+ B/ W, d9 C5 [
  72. 7 x; q( z7 q* }( S" W5 |' t
  73. char *dmabufsrc1 = NULL;7 ?, t5 Z' J( U* L; K: N
  74. char *dmabufsrc2 = NULL;' V5 ^2 @3 G8 B; S
  75. char *dmabufdest1 = NULL;" o9 \* A/ y* t
  76. char *dmabufdest2 = NULL;, N8 R4 h) Y! E2 O3 V: e
  77. 8 |; n* V& E8 {  E; }3 ]$ b
  78. static int acnt = 512;: R" `4 R* [  Z
  79. static int bcnt = 8;' [$ D6 i5 g- V5 u' }) _
  80. static int ccnt = 8;
    0 I" L0 e, o2 S+ Q; K( I3 ?
  81.   k' X& c6 h. F: o
  82. module_param(acnt, int, S_IRUGO);6 c) \$ O* i' j  j, m
  83. module_param(bcnt, int, S_IRUGO);
    " k- S1 ?) V& a: V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- v1 C" r& a) O" K4 J6 G
5 B1 ]& j# x" Z! T  O: W" G/ x7 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y2 w+ p8 s8 P/ I1 [2 j) d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! v, C& m& ~) G+ C( C3 c, x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q' D/ e0 E( ^, k8 V8 ^

& a- N( Y" C5 N0 [
3 H' H- d+ A' ^. J/ d7 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-20 20:53 , Processed in 0.042950 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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