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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 S% C; a- ~7 |8 M+ U
  1. [code]EDMA sample test application- N. u4 n1 A) M8 u+ x  Y
  2. /*
    - E, p8 ^- S( J3 Y; L/ o# t( T
  3. * edma_test.c
    - x7 ?: Z8 B, m% a! r5 }  l  t
  4. *2 Q: O" _$ Z( g1 c) m
  5. * brief  EDMA3 Test Application5 R, y7 L2 B# Y9 j) N% V  X7 s1 ^
  6. *; F  g2 c& `0 C
  7. *   This file contains EDMA3 Test code.+ R3 e1 b% W4 [, u' N. w) t+ c5 {
  8. *+ `; j- n1 A9 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ {+ [) K8 q- c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# {* j8 ^* `' h+ H, Y
  11. *         TO CHANGE.
    7 p! q7 e! F& ?# J
  12. ** _1 V# Y5 S8 z6 s3 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 [2 ^  C, D6 }" Q8 N- V5 j2 _
  14. *# j8 T  k3 A* N
  15. * This program is free software; you can redistribute it and/or
    # {# m2 K  S+ N& v4 R7 Y
  16. * modify it under the terms of the GNU General Public License as
    , K6 i, Z2 {5 T3 D
  17. * published by the Free Software Foundation version 2./ B$ n. y6 d; Z2 g4 q1 Y8 L
  18. *- C; b, j- A1 e9 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 z6 H) K& \" U8 @0 n
  20. * kind, whether express or implied; without even the implied warranty# F$ k! |0 V. A8 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 i0 u/ T! j9 Y4 I- Y/ `
  22. * GNU General Public License for more details.
    # t& ^2 A2 f/ g# h4 E# Y
  23. */  m. C% A( E2 G  S' l  W% ?
  24. ; f. f% I7 _& f2 @
  25. #include <linux/module.h>
    5 @& B' D( V, J& \9 [
  26. #include <linux/init.h>
    ! n+ p" T. `( \, }6 C- `4 E) Q
  27. #include <linux/errno.h>3 H( u) U3 G  c0 b1 J/ _5 F7 q
  28. #include <linux/types.h>1 p: e, Z, v0 ^
  29. #include <linux/interrupt.h>$ r  H% |2 n  D4 i  z, v
  30. #include <asm/io.h>
    - L* E* e& z9 Q: q* i4 W2 h
  31. #include <linux/moduleparam.h>" o1 k: ^& G* C2 D  r
  32. #include <linux/sysctl.h>
    1 u" r. @; \& G; p3 k: Q. B
  33. #include <linux/mm.h>) |4 X6 z- v4 E  w. `
  34. #include <linux/dma-mapping.h>
    ) s. v; M9 K. e9 ~! \2 g. C4 g

  35. " n7 Q; }3 T2 U3 A
  36. #include <mach/memory.h>
    9 g+ ]2 K5 l+ Z) k8 w' p# ^
  37. #include <mach/hardware.h>6 t+ A1 X' y0 s3 U
  38. #include <mach/irqs.h>
    * B! ~! L5 g: q/ z) e# U
  39. #include <asm/hardware/edma.h>% o) k6 V2 m( ]
  40. 8 M7 K' L' w' }3 o6 c+ P
  41. #undef EDMA3_DEBUG, z- b1 U# H/ }
  42. /*#define EDMA3_DEBUG*/
    - p1 W: t* c) S$ b4 z' M8 y
  43. % B0 D  j0 n% n' a
  44. #ifdef EDMA3_DEBUG
    + V2 D& j% i1 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! e6 b* P% w3 W3 z/ R0 y7 |* ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ T, r& E% c* S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + `0 P" _9 g/ G6 f
  48. #else6 v4 O8 b2 R. T' Z) O2 h0 [, g
  49. #define DMA_PRINTK( x... )
    5 n8 D% J$ X& @* t! C0 u
  50. #define DMA_FN_IN# P, ~$ `- A/ k, v1 R' x3 B
  51. #define DMA_FN_OUT
    ; X( r8 |. f! ~" R! i! ~0 s
  52. #endif
    * W" ]6 p# [+ R' W+ U3 [
  53. ' X- n: y$ M1 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! v  M, o  [7 M' Z, {" a
  55. #define STATIC_SHIFT                3# r+ N) l' T7 h$ V' p  d0 z
  56. #define TCINTEN_SHIFT               20
    ' g4 G" q# Y- W+ I( S3 ~
  57. #define ITCINTEN_SHIFT              21
    & Y  y2 Y+ [* p% }/ k
  58. #define TCCHEN_SHIFT                22
    . }' n1 n4 b' m3 p+ c( L. O
  59. #define ITCCHEN_SHIFT               23
    + l2 D+ |" U( j- l9 a
  60. 9 j' Y; Z: L$ j2 U+ v- Z
  61. static volatile int irqraised1 = 0;
    : d; P! E5 d7 c% ^6 T
  62. static volatile int irqraised2 = 0;
    " ^1 C. M- n9 N6 @" K

  63. $ o+ K2 M7 s1 K, p/ F6 G: w: v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z, T8 ?; d; n* u: O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R! j/ Q6 h5 E9 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l8 F0 u' Y% ]: S

  67. ' [4 _$ S" Z0 u
  68. dma_addr_t dmaphyssrc1 = 0;' o0 d5 R& T$ [; b4 t  x
  69. dma_addr_t dmaphyssrc2 = 0;7 o  n4 W7 F3 D$ b9 _3 k
  70. dma_addr_t dmaphysdest1 = 0;7 l; P) C- Z+ _/ e( i3 G; w
  71. dma_addr_t dmaphysdest2 = 0;
    : X0 }4 S4 i7 P/ o8 a1 Q

  72. + w( B& e& q  R4 [
  73. char *dmabufsrc1 = NULL;) B$ W/ J9 l: d7 b9 O0 s* o9 \
  74. char *dmabufsrc2 = NULL;
    ; a$ g7 n& [% n( h
  75. char *dmabufdest1 = NULL;" K: B. |* c1 v
  76. char *dmabufdest2 = NULL;
    / e* B: k6 [, {( J2 G

  77. & l# U+ ^( q7 }4 b% v
  78. static int acnt = 512;
    ; s4 T* f. ~4 g  w2 u8 \$ }: B
  79. static int bcnt = 8;
    + w7 [) Z0 n, M8 o
  80. static int ccnt = 8;5 [; ?4 Y1 L5 q# H" a

  81. $ |/ ~% o" m1 r- j/ ]9 P: Y
  82. module_param(acnt, int, S_IRUGO);
    ! p; U. {. b$ z  q9 ?( U- G
  83. module_param(bcnt, int, S_IRUGO);
    : `! H0 i7 z# z$ n# d. G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, C$ v5 `9 U* M8 A% [6 D
, v5 b. ~( D: E! s, s- K1 n  z' a- ~' @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R" }/ U# C- ?- D! H7 c$ K& ?; Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" J+ s9 v/ p1 u0 D0 Z, c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' y( Y, Q1 ~8 S7 ]

' Y# D' _% N/ ~! r* j
8 X$ V4 Y  d% U% Z& r9 o, G: ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 12:58 , Processed in 0.038431 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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