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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & K2 x4 G- Z  {, \8 \; N. H
  1. [code]EDMA sample test application
    4 d9 Q; K7 `. S' l
  2. /*! K( f  |  {! }; h. g6 ]; ~8 N( H
  3. * edma_test.c
    ) w6 O$ x8 P% ~
  4. *4 P6 R: k, l& e) b) n+ F
  5. * brief  EDMA3 Test Application4 w8 U$ I! S! L5 g
  6. *2 m' u) u  w, d* Z, A- I( p
  7. *   This file contains EDMA3 Test code.
    ; [. I1 S9 w) x1 r. [
  8. *! K4 o! B; Y% Q$ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - n2 S  }7 ]6 d) Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 o9 N' j1 M3 G* G. U/ E
  11. *         TO CHANGE.3 }; U8 \+ y' q5 ?  X8 v" s
  12. *) R$ v( g5 s7 D. W# @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Z6 o. I1 B! L: M
  14. *% v  g' H7 A7 {8 E1 |
  15. * This program is free software; you can redistribute it and/or0 r7 |: V( N( x1 K
  16. * modify it under the terms of the GNU General Public License as
    4 G) i) S7 A# I
  17. * published by the Free Software Foundation version 2.! u/ ?) s  f& ?
  18. *; Z) B) b/ O$ ^6 ^8 K7 [$ F% _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 f% A3 M! u  J' J: Z' n
  20. * kind, whether express or implied; without even the implied warranty
    + M$ \( I2 w0 Y; o7 x. s" t0 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) d8 g" P2 ~1 L& H3 F. v! }5 W7 i9 ?
  22. * GNU General Public License for more details.3 D' \" ~6 c, i7 R# m& W# ?: k
  23. */1 p6 i8 B& N7 [" Z* S

  24. ) [9 H: x5 i) X3 }! R
  25. #include <linux/module.h>
    $ ]! `+ c7 V( u; c6 {
  26. #include <linux/init.h>
    + k$ T: W% |( X* ^  }2 M
  27. #include <linux/errno.h>; p' ?( S) V) f8 [- g6 K8 `
  28. #include <linux/types.h>( v  `3 N( T2 N
  29. #include <linux/interrupt.h>
    + w% E: \6 |0 }% \! r1 s3 g% w
  30. #include <asm/io.h>& f8 Y/ `" f' t3 i( X% e
  31. #include <linux/moduleparam.h>
    ! C9 @" V( ]! U* l5 ~& s
  32. #include <linux/sysctl.h>  d$ t5 C& p# p" f$ L
  33. #include <linux/mm.h>9 q0 R5 \$ f7 [( o  y
  34. #include <linux/dma-mapping.h>
    % D$ i4 l$ L9 Q3 F" ?' n, n8 p
  35. " d" z' O/ k/ a5 y
  36. #include <mach/memory.h>6 [9 U1 S: Q2 C" j- k) ]4 i
  37. #include <mach/hardware.h>6 z7 o$ L% Q( e4 M/ d4 S
  38. #include <mach/irqs.h>8 t7 k5 r& Z0 Q6 g" ~$ m; ?
  39. #include <asm/hardware/edma.h>
    . R9 o8 E! c' d4 z. l
  40. # E/ `1 G1 r) b9 O& N2 _
  41. #undef EDMA3_DEBUG" B, k, E  Y8 ^; _( @
  42. /*#define EDMA3_DEBUG*/
    & k, Q5 F$ X% ]3 k1 o- c
  43. & w/ S7 G% i4 m
  44. #ifdef EDMA3_DEBUG! V9 a! v( I; q, b- }, w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - |2 Q8 w4 }% q+ f- l1 |, M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 x: m. Y7 |8 {1 m, d1 `1 `3 l9 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 y7 h# w7 |) I0 q2 ?
  48. #else
    8 K* t  O& G4 k& B* ^* a
  49. #define DMA_PRINTK( x... )& w& D9 d+ m4 A6 B; `0 f5 u% ~# O. Z
  50. #define DMA_FN_IN
    9 B; V% E! l% H2 r  j! v! r+ }4 {
  51. #define DMA_FN_OUT5 F& u% p8 s: L* g5 L' p% z8 k
  52. #endif  M) K* l) t: w. h

  53. ) z# Y; i0 z, y  L4 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 [/ H5 ?6 i$ ?+ @; e
  55. #define STATIC_SHIFT                3
    ' n) x% ?0 L3 s! S/ w
  56. #define TCINTEN_SHIFT               20( h4 b2 I9 O% d& }
  57. #define ITCINTEN_SHIFT              21
    . o! S8 y' V5 ]
  58. #define TCCHEN_SHIFT                22
    , a! H8 Q; P( a$ [) N) g
  59. #define ITCCHEN_SHIFT               23  x: E) m: y: \* ?7 R$ b
  60. 1 M2 G/ h2 E7 B* C8 W% L$ Z$ i$ W( _. q
  61. static volatile int irqraised1 = 0;
    $ `0 L4 i. |9 ~3 z8 a* @% ^
  62. static volatile int irqraised2 = 0;2 d+ f, t+ `7 V9 e- R1 t

  63. ; s3 b+ d+ F7 F! |+ I, y7 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [6 g( _3 }2 j9 B* X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" z3 ^0 i: k, H0 F( V/ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L! c4 [# y. m4 A4 V

  67. 8 _& \' i7 m3 R  I9 a4 L
  68. dma_addr_t dmaphyssrc1 = 0;
    - v! A/ \- d% h/ q2 v) I; h) p
  69. dma_addr_t dmaphyssrc2 = 0;
    9 U  P& R6 L$ {# k  D' W8 @' E3 n  v
  70. dma_addr_t dmaphysdest1 = 0;1 c( l& Z/ @% G$ j
  71. dma_addr_t dmaphysdest2 = 0;
    , c  y4 c+ \% I8 Y; ?

  72.   ]7 ?( N' @; [& @+ N( D
  73. char *dmabufsrc1 = NULL;
    ( S; D8 A- M: p; K$ r
  74. char *dmabufsrc2 = NULL;
    9 X2 O  ~  K3 R7 f5 k1 f- }- @
  75. char *dmabufdest1 = NULL;2 _1 N+ W$ `" T( j* f$ u
  76. char *dmabufdest2 = NULL;
    / B$ O- k# g* R

  77. - I5 d4 X& B# @
  78. static int acnt = 512;
    6 t0 m: I9 Z8 M0 o8 b9 E' Z( n2 A$ {
  79. static int bcnt = 8;
    5 s- z3 P( D1 q1 ~, L7 {
  80. static int ccnt = 8;
    6 U5 }, N: V& m- p2 K

  81. ' l5 b; o- n9 {+ E7 T/ l, \
  82. module_param(acnt, int, S_IRUGO);1 a* h- m& ]0 ^% X! x
  83. module_param(bcnt, int, S_IRUGO);
    * Q; T9 s, t/ x  ]8 q( X. |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" G$ {5 v* J* O" J# ^' F/ [
6 Z+ ?' j- }/ d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) F: @& \# z5 M7 @  p1 O3 c6 z$ P* |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ @, ]0 N1 g' a4 z. D" U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O9 f8 f8 x. |8 e

" P5 w1 h$ u5 ], P; R0 T# p: l# c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 18:25 , Processed in 0.038894 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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