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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " y8 N8 S% [% G7 D% y
  1. [code]EDMA sample test application
    6 d. J9 Z5 s: l& ?9 J+ A" W8 w: T
  2. /*4 u- ]2 H4 p0 x) W8 W5 S
  3. * edma_test.c- P' ]" L! r3 f0 r) g4 d
  4. *
    , l" v/ Y7 \' {  T) k, J
  5. * brief  EDMA3 Test Application
    2 r5 f  m4 y4 X: ?/ q
  6. *
    % G3 {: ~, S% j/ A3 E
  7. *   This file contains EDMA3 Test code.4 t/ q, _8 i, g" W
  8. *
    5 k5 N; Q, z5 t# x- b3 [  Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 j% p' W5 g& l1 e1 S9 V) U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! {# l5 ^+ Q* G0 a- P1 H8 f# R% U- i
  11. *         TO CHANGE.5 i" h  }' w2 g4 x% E( F1 I, C
  12. *) i+ i- O7 ~8 R9 R  n: Q7 D0 n0 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& J7 z; E# h/ }% ?1 Q
  14. *$ Q/ t  {7 c( n$ i, |7 B2 n
  15. * This program is free software; you can redistribute it and/or
    ; P* V6 L# P) v. h* @& @# [* A
  16. * modify it under the terms of the GNU General Public License as
    , R* w1 r0 V' k; H' F- @
  17. * published by the Free Software Foundation version 2.) Z) a$ ^# F; z* z' F% [7 E
  18. *: t  b( J+ z( H8 Q# K8 i5 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 X- ^. y( a4 L0 I$ |8 F; _( ~
  20. * kind, whether express or implied; without even the implied warranty6 g5 ?, O6 c. M: Z7 U# G1 L5 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 R  }! g- i# b; Q4 I& v  W2 q
  22. * GNU General Public License for more details.9 g3 U, `/ k4 j  c
  23. */  U2 t, y/ {3 J6 i- p0 z/ H
  24. 8 g# {9 ?3 E, B2 w( i; h' d
  25. #include <linux/module.h>7 W* z2 p% @: D0 D8 q
  26. #include <linux/init.h>3 C% e/ r& \5 d
  27. #include <linux/errno.h>
    : y4 e1 O4 |( L
  28. #include <linux/types.h>
    ' c8 W+ W; |3 y0 [0 ]5 _+ R2 b
  29. #include <linux/interrupt.h>& e( V  O( _8 k9 e: @
  30. #include <asm/io.h>
    + x7 @! w# a5 E, M& x2 N/ I
  31. #include <linux/moduleparam.h>, e- d+ {0 x5 ?1 e
  32. #include <linux/sysctl.h>
    / Y7 t6 ?; n# M
  33. #include <linux/mm.h>
    7 i, o$ X% Q& d, C
  34. #include <linux/dma-mapping.h>
    9 Q( u) V( d5 m
  35. $ m! e0 {1 {0 S$ u8 z; _% o
  36. #include <mach/memory.h>; k0 d' h7 k6 ^: q- M
  37. #include <mach/hardware.h>7 E# H  V& T, V, n/ E7 _
  38. #include <mach/irqs.h>1 ^( g1 r# \' X5 L" s
  39. #include <asm/hardware/edma.h>: f! h0 r' C1 L0 _- n$ b3 v

  40. * c$ @, Z4 g* J8 ], a
  41. #undef EDMA3_DEBUG: m) k2 ^; s9 @5 X: A% u7 e
  42. /*#define EDMA3_DEBUG*/
    ( ]/ D3 r& C' o& J

  43. - U7 p) f5 u& O6 J, F2 G" S/ `
  44. #ifdef EDMA3_DEBUG
    " D: e8 B! R8 M9 x& T8 W3 O# `7 e; v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); b8 }  E- n$ ?# [: {' t! i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% L9 W+ X6 T6 J$ W* C- Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ~% Z% m7 @) {6 F' }! Y
  48. #else
    $ D/ M8 C5 K5 x5 C, V4 j
  49. #define DMA_PRINTK( x... ); ^4 [4 C* |7 R+ {$ D. D' l0 G: d
  50. #define DMA_FN_IN
    + {, ]0 D  X/ w9 y# n5 W: ~
  51. #define DMA_FN_OUT
    . C$ t" ^; q! S& R$ e4 G
  52. #endif
    . g- d% t/ @4 r7 C! |/ D( _
  53. 4 Q% k; m2 ~" v; Y! X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 A: O7 T* l; R* m0 F% y# Y% K
  55. #define STATIC_SHIFT                3
    & x8 _4 Q7 j/ ~  o
  56. #define TCINTEN_SHIFT               20
    / B5 J5 p+ Q' U0 E) l2 y) T" [
  57. #define ITCINTEN_SHIFT              210 U* J* N' v# X8 P* N5 r1 J
  58. #define TCCHEN_SHIFT                22! A5 g! w4 Q8 w! M. ^$ n3 y: R; d
  59. #define ITCCHEN_SHIFT               23
    6 @) S3 w' d: {
  60. - i7 D, K. b* Z& |( j, M( u; |# l8 v+ o
  61. static volatile int irqraised1 = 0;* q. d( I$ Q0 |
  62. static volatile int irqraised2 = 0;
    ! `) X5 t( r* D  X3 u! r- A2 g
  63. 7 ]! C3 M- I/ I2 b: z4 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 f7 ]; Q: O6 l$ ~' @2 F8 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 m% N' a. D1 w: f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 q# T2 x- }2 }4 ^( _
  67. & f/ f3 g# t# O2 Q6 w/ A: M! _
  68. dma_addr_t dmaphyssrc1 = 0;
    8 Z! s- |' k# u4 z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! {5 w  K4 i  L# z' H
  70. dma_addr_t dmaphysdest1 = 0;6 W2 @6 p3 ^+ s1 T4 \4 J) h9 w' [
  71. dma_addr_t dmaphysdest2 = 0;
    / m! L" i1 Y9 s0 Y5 z
  72. : A1 a+ N5 p: e9 i9 {9 t
  73. char *dmabufsrc1 = NULL;! R/ H/ S) y, P. b- `, l3 c
  74. char *dmabufsrc2 = NULL;
    - Y. M$ O6 z- X- ?0 E
  75. char *dmabufdest1 = NULL;/ V1 f1 l) ~% h1 x* D6 [
  76. char *dmabufdest2 = NULL;
      v9 n9 ]2 `6 |# z# P, Q9 V

  77. + K) V, a7 w$ s0 h* ~$ b* k5 `' u* \
  78. static int acnt = 512;
    1 T0 l7 j+ y1 y
  79. static int bcnt = 8;
    + D& O7 W/ K6 Z, e+ o7 N
  80. static int ccnt = 8;
    6 @2 ^. Q" L2 o3 `8 Z2 P
  81.   m2 M' C+ R5 @
  82. module_param(acnt, int, S_IRUGO);: j! \, z2 r! v: F2 v$ j+ u9 b: J
  83. module_param(bcnt, int, S_IRUGO);
      d$ z, b- x3 k2 f+ I8 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' b2 h7 q) ~6 ]$ X/ _, }

) _. J/ Z; n9 {2 O9 O( z6 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 }4 v9 {8 ~8 H8 y. jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& N+ }" [0 S+ R* I+ T6 o8 \  E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 O1 ^+ \" F& D& }5 z6 B3 b% F; @" ^2 ~7 c8 m0 }

& ]/ S% R2 q6 p0 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 23:37 , Processed in 0.039734 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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