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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 |, q; f! w3 {* X3 f, p
  1. [code]EDMA sample test application+ N. i2 T8 S1 E( T2 n  {$ z
  2. /*7 N+ r  l' S# Y2 ~( Z* u6 i
  3. * edma_test.c, D! H* |* F8 C9 o' H: g- p2 p2 z) v
  4. *
    * n( s& h  k; @- x) W9 Y; I
  5. * brief  EDMA3 Test Application
    6 @" |$ x+ \9 T- o. u* Z9 _
  6. *3 D9 B( b' B; f8 |3 |! _
  7. *   This file contains EDMA3 Test code.
    ' D2 B  U0 a* q# q- u. V
  8. *0 A( r0 X4 Q4 \- H3 Y( M) C& s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " O, Z. O/ Y) o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ u( \' G! {' [1 m. Z- P
  11. *         TO CHANGE.
    0 T& C6 @- e; b% I' a
  12. *
    : m, L/ C; n6 j% \5 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 i  E1 x4 f: N. _% E
  14. *
    / T6 g$ p+ _" }9 }" B$ Y8 n0 K3 ?
  15. * This program is free software; you can redistribute it and/or6 {! D1 b- b7 u$ J2 o9 A; F9 V
  16. * modify it under the terms of the GNU General Public License as
    ! e: Y: F0 o! I4 k$ [4 H% q
  17. * published by the Free Software Foundation version 2.
    ' b* D+ O6 c! b- G% x$ f4 B; w& w, F
  18. *. H3 w" U* u& I! Z; k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " b4 u0 n4 o# K* P" i. p
  20. * kind, whether express or implied; without even the implied warranty
    - D- J# |4 O, r7 ^: `" c' [/ v8 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 `% ~! E! F; u6 g% S9 |
  22. * GNU General Public License for more details.5 T8 G7 Y- g, D6 c0 W( k
  23. */
    - x1 a7 Y. T9 |- _
  24. 3 [# `$ X- ]# }+ S) N" q
  25. #include <linux/module.h>
    6 P* J4 F$ D3 v4 A- q  ]$ w
  26. #include <linux/init.h>
    7 Z+ r! y! J8 y2 T. V6 {; _
  27. #include <linux/errno.h>
    6 q* ?# S- f* c9 ^' b
  28. #include <linux/types.h>" C, ^4 o( O- [3 |" \- M. s! n
  29. #include <linux/interrupt.h>
    , E% _# o4 C; u3 V+ M
  30. #include <asm/io.h>
    * i- U& D2 t; v
  31. #include <linux/moduleparam.h>
    / r0 d  M; s: }
  32. #include <linux/sysctl.h>
    & w* C: J# \! B( g- N
  33. #include <linux/mm.h>
    1 F. ]7 w# {1 Q7 g: w: {0 h7 S
  34. #include <linux/dma-mapping.h>( L+ Z- u& o0 \5 w4 {; x" V* x# n
  35. . c0 G" n+ J6 i# T) h- W
  36. #include <mach/memory.h>- a7 b% F: X. K/ r
  37. #include <mach/hardware.h>; z+ N# O5 ^; h
  38. #include <mach/irqs.h>7 Z' T, v0 L$ O# y' Z
  39. #include <asm/hardware/edma.h># x- t, I* Z' n8 q; w) I
  40. ( P3 x: N* U) s, f* j$ D+ D  U
  41. #undef EDMA3_DEBUG: O# H# U$ N5 q
  42. /*#define EDMA3_DEBUG*/
    # A$ O4 C1 ]! V) J' ^! W/ e

  43. : Q: k6 M$ P& _7 x" C
  44. #ifdef EDMA3_DEBUG  a3 B( W" B5 x! s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 @1 P. P/ @+ Q, Q9 z# Z* q. I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 o6 y9 y" @) a8 |( X" k9 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); [& L# n. ^! R. j; n$ O! `! U
  48. #else; @4 {2 _7 p- J
  49. #define DMA_PRINTK( x... )3 |. ]4 P' o$ J7 t& _# O
  50. #define DMA_FN_IN2 n" I& p- l  w2 ?; H! x  m' m
  51. #define DMA_FN_OUT
    4 q( ]* k, B: x- E5 T0 X
  52. #endif1 T, _- E: t% W! ^) a

  53. " ~8 s2 i9 A! X: Q2 ]+ c: S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / k& B+ m$ j7 E: z+ T+ ~8 R
  55. #define STATIC_SHIFT                3  w% b# G3 G; @$ J6 x
  56. #define TCINTEN_SHIFT               20! U; C" s1 S& e
  57. #define ITCINTEN_SHIFT              21
    , K% I$ l+ k+ t3 O
  58. #define TCCHEN_SHIFT                22, l0 t/ j, P! O; G2 ~
  59. #define ITCCHEN_SHIFT               23
    ! `7 t6 G& i# ^  B* [
  60. $ ]* O5 a/ H8 z2 m* s3 W
  61. static volatile int irqraised1 = 0;+ e% q5 a$ w2 W0 u: ^- Z4 V
  62. static volatile int irqraised2 = 0;# q& H# r! A% r  w$ P0 t1 ^
  63. . `, B# e0 T& g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / T" H1 y$ ?, s8 }; v  g: [8 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~$ p7 ?8 ^, y" j+ w$ y* X+ z5 M* q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  W6 `4 K9 G: t, F$ U# G3 V( l

  67. : u* v7 a' m+ A  p9 s
  68. dma_addr_t dmaphyssrc1 = 0;
    + u- w7 M/ w; }$ N
  69. dma_addr_t dmaphyssrc2 = 0;- M( a0 s8 T, X% C  X3 p* {' V
  70. dma_addr_t dmaphysdest1 = 0;
    + y& c. I6 Z  F2 x% G3 F
  71. dma_addr_t dmaphysdest2 = 0;
    ' l* S/ t# j0 t. _- b

  72. 4 `6 f% L2 l7 f5 E# s* S; n
  73. char *dmabufsrc1 = NULL;
    / o. y0 V( i. Z
  74. char *dmabufsrc2 = NULL;( B3 Y- J/ E, y5 R# e* N" W, s3 e9 B
  75. char *dmabufdest1 = NULL;6 u- [2 Z- Y; X5 t, G
  76. char *dmabufdest2 = NULL;" e( b, i  x/ e. `
  77. , E. ?3 z+ B9 E1 J( b) O  t9 U
  78. static int acnt = 512;. }1 T; y# x  A* [+ h, S. d
  79. static int bcnt = 8;, f- A; ^. q3 D* j
  80. static int ccnt = 8;
    : k" R: l5 D0 W

  81. 3 `: K4 q  U1 _; h7 k3 k
  82. module_param(acnt, int, S_IRUGO);
    * o7 f+ L8 q; f- l( ?! D
  83. module_param(bcnt, int, S_IRUGO);
    9 a% [( X. J! `0 v$ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, W1 {$ N; }+ x4 e8 a3 W( Y0 c, s  O6 P2 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& D  k% Z' X& }- Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 I/ B2 F* H) F4 F: n  P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ^9 h& U0 c( r+ u% C! S: q
% S3 h6 x5 E/ g- ]' @
: d0 c2 P% t3 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 19:47 , Processed in 0.046416 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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