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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& F, H- R5 {, V
  1. [code]EDMA sample test application
    ; }/ x6 @# D5 E0 U, Y8 o
  2. /*% C3 V( i2 [+ Z( n) S- m6 D7 x
  3. * edma_test.c. z( H5 K5 e8 `$ M4 u
  4. *
    - P: u& `. [5 l# U3 s2 s
  5. * brief  EDMA3 Test Application
    " s! q* D' _2 y, n
  6. *
    : I5 i6 o1 C# }2 G/ V
  7. *   This file contains EDMA3 Test code.
    5 A8 l' d2 T2 @
  8. *
    5 e( `; v1 G9 a2 M) q+ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C4 W/ {9 V& K, H( c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 q* {5 m7 q( i5 }+ \
  11. *         TO CHANGE.
    ( A: _$ r, M4 y4 e
  12. *0 P' k* L+ W% L' p0 N0 \: h) [+ {- w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , v8 d- w: W6 x- G; ~
  14. *
    6 B5 N  x, v" B9 e' f, d, I6 F
  15. * This program is free software; you can redistribute it and/or
    & z" t0 a9 B  ^, T( _) e9 T
  16. * modify it under the terms of the GNU General Public License as+ H. X6 \" |) H7 `3 n; H
  17. * published by the Free Software Foundation version 2.
    " x0 {3 T3 y8 ^( R
  18. *
    6 l) ~3 R* q- {/ e! v7 v. _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / m/ d$ k% `; C0 ]; l% b
  20. * kind, whether express or implied; without even the implied warranty  m. c) S( K! P" q% `8 C  @8 Y$ e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 i/ Q" m/ S" e
  22. * GNU General Public License for more details.
    1 ^" _9 F. U" U# Q& V+ p
  23. */: _6 u" E# J1 h( _2 P$ f: h
  24. ' ~/ v2 R4 n2 h8 w* |: F3 D
  25. #include <linux/module.h>
    9 ]. S+ g% D) J; d% n  B7 c9 A) }
  26. #include <linux/init.h>
    - U1 i% ?& q  ^. W( P& S0 K* x
  27. #include <linux/errno.h>
    6 `# W; O7 b# \% [" a! _
  28. #include <linux/types.h>
      N# H% Z/ G: k, J9 i0 [% q8 U0 G
  29. #include <linux/interrupt.h>
    3 k- T) E1 Z. e2 T* f1 E7 L
  30. #include <asm/io.h>
    , @3 ^( N1 ?) [" D$ a: Z9 a
  31. #include <linux/moduleparam.h>
    0 U6 R, c( G+ n: P' [1 j9 b
  32. #include <linux/sysctl.h>* a1 X3 C' R' @. B" N
  33. #include <linux/mm.h>
    6 l# {' l+ T4 P/ t) W
  34. #include <linux/dma-mapping.h>  Q  {2 n9 C2 C& ?. i9 E: [, L' {

  35. " u0 m# y" b+ w6 o1 y3 Y7 @! e
  36. #include <mach/memory.h>
    " v6 h# s7 w5 ]( j7 \
  37. #include <mach/hardware.h>% u" ?0 t$ d! b: e
  38. #include <mach/irqs.h>
    " V; q+ p* c2 H4 w; R9 ?2 h! [0 ~
  39. #include <asm/hardware/edma.h>
    + L1 t1 C1 w+ U
  40.   O3 Y) `1 M9 O) F' b
  41. #undef EDMA3_DEBUG
    3 O1 h* m# H; t' g0 i1 O% ~
  42. /*#define EDMA3_DEBUG*/
    ( ^3 p% o9 p% L8 G4 l2 U  N
  43. 7 q; _* X' `5 ~2 Q1 S2 K9 Q
  44. #ifdef EDMA3_DEBUG+ @8 M% E4 H$ W$ }5 ?% Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , Q" R8 |+ o8 T1 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), u$ t5 L  u. u, `5 g( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 ^4 E3 }- ]# T# z6 o) y  r
  48. #else; A; y( m$ |  `
  49. #define DMA_PRINTK( x... )
    2 X# t( W: P% Y: }0 q
  50. #define DMA_FN_IN2 p& F2 k$ T, R4 f, ^
  51. #define DMA_FN_OUT; X  ]4 T. I+ m: Y7 _' ?) k* J' o
  52. #endif' G  P; B1 x' V6 s; l* N

  53. 7 z% W# |' K  B' H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 N) L) S0 x: n- u, U* h$ |
  55. #define STATIC_SHIFT                3! [1 t7 k& P3 }& q. X% Q& D
  56. #define TCINTEN_SHIFT               20( |: n; ^& B+ d
  57. #define ITCINTEN_SHIFT              21: @- v6 b& I3 r6 O2 l3 g' w
  58. #define TCCHEN_SHIFT                22, L. d' O3 ~# F# L' Q9 ]& i; N0 H3 F
  59. #define ITCCHEN_SHIFT               233 G4 C* @. p; F# N

  60. . ~& X" J' r; ]8 K) G1 L
  61. static volatile int irqraised1 = 0;' R" P$ ]& n3 c6 h
  62. static volatile int irqraised2 = 0;+ F' r8 \. B+ R! X
  63. : A5 v0 P3 n; }+ n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Z1 F# P! l; m+ h1 i& ^, n" M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C! d% H2 e- I+ ?5 q: ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % \) c0 q' B0 m2 m

  67. , d2 `+ ~6 |2 q" u
  68. dma_addr_t dmaphyssrc1 = 0;
      m1 ]- I" s# ~! A3 ]+ Q$ L4 }, M- A
  69. dma_addr_t dmaphyssrc2 = 0;
    3 a. m- X3 g* o2 E
  70. dma_addr_t dmaphysdest1 = 0;! m% @# k, }, b3 i" K" Z; I- ^
  71. dma_addr_t dmaphysdest2 = 0;
    & O9 @8 K) I9 i8 l! n

  72. 8 j9 k! L& j( X2 ~1 v, Z0 s
  73. char *dmabufsrc1 = NULL;) D" N% h' V- L
  74. char *dmabufsrc2 = NULL;$ L5 |, K  F# s* e- |: r
  75. char *dmabufdest1 = NULL;
    * w+ ~3 G8 D  G5 c7 Q) d
  76. char *dmabufdest2 = NULL;( Q3 ?* ^( n1 ?

  77. % h& S: y6 ~3 S2 E% s+ W: L, {
  78. static int acnt = 512;( B6 h  U, r8 y; G
  79. static int bcnt = 8;
    ' U; e2 n) X6 w/ E
  80. static int ccnt = 8;
    1 D, z0 H9 ]# }  g. T! M+ ~5 x
  81. 8 O+ O( [2 b/ @" `* a# X
  82. module_param(acnt, int, S_IRUGO);
    ( I- T$ J& ^* x( t, x/ U
  83. module_param(bcnt, int, S_IRUGO);% \7 T, f, d5 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, T; S  p; p( E2 L
5 w' i' K5 @8 D  m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" M4 s8 l( P7 l( w, ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# }8 X: n" I" M' ~% N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 P* v$ E) Q5 }6 S
' c, \2 t* Y5 @6 u+ P: s" ~& Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 14:38 , Processed in 0.041038 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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