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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 m" K+ @. p, Z9 S9 Y
  1. [code]EDMA sample test application
    5 m% m  n" L: [3 S/ v& j* @# e8 x
  2. /*
    ( @3 X" Z1 Z1 J5 j- W9 H: v/ S
  3. * edma_test.c
    $ t% f2 m+ `$ ]/ @0 R! ~+ n
  4. *
    * Q7 z0 P2 W3 T, r) `
  5. * brief  EDMA3 Test Application
    % l( b1 I+ }+ u, \$ N
  6. *  a9 n/ P9 S. A8 n
  7. *   This file contains EDMA3 Test code.' R9 H: l' }9 `+ ~8 h: a
  8. *
    ' l# w1 ]5 X- \# S3 R# K5 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# z) N! D+ x9 ~, e/ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ~# j  a9 c0 _% l5 n
  11. *         TO CHANGE.; j9 v3 f( ~+ g9 i1 e
  12. *5 e4 Z, W6 C& R. q8 y2 _6 D9 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P; K6 c& _% j: g; v' b2 p0 o
  14. *+ C* C+ d$ i5 t: x! ?8 C6 S" F
  15. * This program is free software; you can redistribute it and/or8 K4 m; {! M1 v: m
  16. * modify it under the terms of the GNU General Public License as
    8 H, k( q( O" j7 ~4 t) K* j! |
  17. * published by the Free Software Foundation version 2.
    6 r1 u9 w, E1 A
  18. *
    1 ~6 K/ q  W" l' X' b3 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ]) C2 a3 D( C
  20. * kind, whether express or implied; without even the implied warranty3 j! R6 L7 i9 x, g6 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) R, }9 p9 S" Z4 A' [% U
  22. * GNU General Public License for more details.
    1 B3 |8 z$ u) R, P5 Y$ d
  23. */3 }, W- ~. m4 |$ P% l3 `# o

  24. ' y/ u4 H8 p- k9 a
  25. #include <linux/module.h>
    2 M* M) V5 P& s/ ~" N
  26. #include <linux/init.h>
    ! c- ?! n4 R% D' I1 M/ `% W4 e
  27. #include <linux/errno.h>
    ; N# W5 b5 m* ~
  28. #include <linux/types.h>
      A% j3 t; R+ d
  29. #include <linux/interrupt.h>
    0 g. }  ^6 t2 [; ]
  30. #include <asm/io.h>8 Y! ~; R7 t5 T) O. c2 O( j
  31. #include <linux/moduleparam.h>
    9 ]5 s0 r" s, U0 n, ^: q
  32. #include <linux/sysctl.h>
    # z( h5 i9 F' h" r+ G1 R7 P8 p
  33. #include <linux/mm.h>
    ) n, g; G6 @# f% C: p& [# F
  34. #include <linux/dma-mapping.h>( f+ h( j2 h& z# l5 M2 H5 m2 s* t- Q
  35. ( w9 f. ^# z  \: {3 G
  36. #include <mach/memory.h>: h% K/ ^2 r! L
  37. #include <mach/hardware.h>' ~1 s$ ~- J: Q" l
  38. #include <mach/irqs.h>! X4 M8 J/ m+ o
  39. #include <asm/hardware/edma.h>
    6 L7 N3 Y) N. c! u" k0 Q- X) O
  40. / x) V7 G) f9 F2 Z% y1 v0 k
  41. #undef EDMA3_DEBUG6 n  I' V) B8 P- V" f
  42. /*#define EDMA3_DEBUG*/
    * ?4 V* s! r, b. v

  43. / \% h6 }; D# _2 E; G5 O+ m
  44. #ifdef EDMA3_DEBUG; B6 L( \8 Q9 E1 n% j7 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c2 Q  K2 _& \+ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # K/ L, {1 r: C/ V5 m9 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  h# `  q6 O& s+ v4 k$ @: L/ w
  48. #else% w; H1 K" ^0 z) {5 c' g
  49. #define DMA_PRINTK( x... )- X  c5 y/ T4 O- I6 n/ r
  50. #define DMA_FN_IN
    3 P. n3 `, ]0 t1 M3 u$ u
  51. #define DMA_FN_OUT: o. s; W3 J' F5 a9 P
  52. #endif# l, d9 i# I5 u4 z! ~
  53. 7 a4 @' `! H5 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ~! w: n8 Q6 K. ~+ P! S& j, R8 [
  55. #define STATIC_SHIFT                3' e" u1 a4 E& q) `) e* I" z* c4 ]
  56. #define TCINTEN_SHIFT               20
    2 R: p& x# _+ p7 \2 ]5 p- l
  57. #define ITCINTEN_SHIFT              218 S' I9 [$ g+ u2 d! q% F- Z5 Y7 t
  58. #define TCCHEN_SHIFT                22
    7 _# L- w( _. L
  59. #define ITCCHEN_SHIFT               23  o/ U6 L: s" o& A, f- m
  60. % o* `# \/ g9 B8 b$ R
  61. static volatile int irqraised1 = 0;
    ; J5 ]1 Z( p3 E, Q5 G5 K
  62. static volatile int irqraised2 = 0;
    1 g& w; i7 V* }! e% R2 l
  63. & i, E: Q; {# k- L0 ~& L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 \8 K. M2 m, g9 n% s: X& i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j5 ]$ X( \5 ]  e9 w5 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [3 E9 |1 P) L9 X
  67. " S, L3 W8 H. T  b1 ?
  68. dma_addr_t dmaphyssrc1 = 0;9 ?. C! d- c" w% Q7 S6 P
  69. dma_addr_t dmaphyssrc2 = 0;
    - w5 T7 ^& L( n( |5 Q5 P
  70. dma_addr_t dmaphysdest1 = 0;
    $ Y7 c, m# R; y0 R; L6 ~
  71. dma_addr_t dmaphysdest2 = 0;
    : I6 Y, v$ Q! K, y# j; L- `

  72. 1 d! I% B8 |2 u  f
  73. char *dmabufsrc1 = NULL;1 L$ l* T' X( t* k9 W
  74. char *dmabufsrc2 = NULL;$ Z; ?) x. N& e
  75. char *dmabufdest1 = NULL;
    ; S$ s2 o( g7 y' u& k
  76. char *dmabufdest2 = NULL;. {8 y6 ~  `- c3 a7 r/ d; p
  77. * M  ]9 g# G: W
  78. static int acnt = 512;
    5 f& C3 ]1 F( q. D1 @' E' l
  79. static int bcnt = 8;; j/ E, O7 y2 ~4 P
  80. static int ccnt = 8;
    5 X, C+ l+ f5 p# x. K+ f3 t0 c

  81. % C! U. i* E' l! h, f: |- ~0 {
  82. module_param(acnt, int, S_IRUGO);# G: M# l/ n! g! D% X
  83. module_param(bcnt, int, S_IRUGO);; o+ H6 r5 @9 r( i5 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 q& |5 E0 p/ o; f, f5 p0 J2 H; p

! y# S+ a0 {& z9 h1 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ?' d0 K  T3 X- V# G" {, ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P' L3 m) d  B9 n; C: u/ h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c: |6 G0 f. U# {( K& v% b# U2 D
) ~& L4 Z/ s7 w+ U" J6 t# k
3 l* G: D5 Q8 @! h, Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 13:36 , Processed in 0.038097 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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