OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' {$ N9 g7 n. o7 e! ^7 ~
  1. [code]EDMA sample test application
    * R+ [3 s! q& m
  2. /*! ?6 [3 r# J1 O1 i7 Y: W
  3. * edma_test.c) L, z! U! B; H; M# A3 p
  4. *5 |1 [: k' L, }! B4 u# ?
  5. * brief  EDMA3 Test Application
    " f* W- K" ]) [
  6. *  h( e/ v0 Q/ c; n: ~: X
  7. *   This file contains EDMA3 Test code.7 H" @$ |9 o) v- R. R2 j5 n" \
  8. *
      C, C) o. \$ g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ?6 \# r9 T* z( J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 j+ {6 ]# ~/ ?8 W+ _
  11. *         TO CHANGE.
    ; i2 @1 n1 Y2 T# k
  12. *8 C/ z' ~) L, J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & z8 b! N5 s* c0 q- G0 ]
  14. *
    ( V, Z( E: s: h2 m# p( i
  15. * This program is free software; you can redistribute it and/or; e5 V/ `+ N# U% u
  16. * modify it under the terms of the GNU General Public License as
      e. U( Y% z! [1 J
  17. * published by the Free Software Foundation version 2./ y( Y0 `% p" p/ {  `" o
  18. *
    - N& w$ f( \- n! [9 _: @9 m7 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) A& _3 w+ }$ ^1 c
  20. * kind, whether express or implied; without even the implied warranty
    ' ]. M) T+ I# Y3 T8 |4 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 b" t9 ]$ y1 N3 ~, O1 T3 G$ E" X
  22. * GNU General Public License for more details.- O$ Q: j- N3 Y! }% Q  N
  23. */
    , P/ r' ^7 ~& z; @% d" C- j" N

  24. ! B2 D& V9 V4 x  t/ K6 r; z
  25. #include <linux/module.h>; X; N8 g& J# @* C
  26. #include <linux/init.h>
    & Q9 T' S$ e: m6 I! C7 ^9 l0 F# Z
  27. #include <linux/errno.h>+ h5 d1 K: T1 p5 k
  28. #include <linux/types.h>
    ! w4 n2 f1 @3 j( ^0 n3 j
  29. #include <linux/interrupt.h>$ O- Z" {2 r6 b8 W: M
  30. #include <asm/io.h>
      t$ Z$ [" d8 m
  31. #include <linux/moduleparam.h>
    5 A; a  N+ B) G% h6 i
  32. #include <linux/sysctl.h>6 z- R3 `2 E$ y8 k( z/ N0 T
  33. #include <linux/mm.h>9 n  K: Z7 F) m
  34. #include <linux/dma-mapping.h>
    6 M) n: n7 i, g( A

  35. , d! ~% X, B$ A  V) J
  36. #include <mach/memory.h>
    1 H5 \( t: k2 ]/ e* Y
  37. #include <mach/hardware.h>
    # ?- i: Y' Y3 R4 j$ m1 M1 E7 V
  38. #include <mach/irqs.h>
    4 r( O- _9 S/ R5 g9 g, Z! z4 V
  39. #include <asm/hardware/edma.h>) Y' p( Y8 l3 x! ?+ m' Y& I

  40. ! L2 T# I3 V( m# `% v) ~) W& b$ ^
  41. #undef EDMA3_DEBUG6 O0 y$ d+ `- h. `  Y( e- F
  42. /*#define EDMA3_DEBUG*/2 ^7 X0 B1 z; p) O: j/ ^

  43. $ |  N0 s" W( ?5 B- F% h: C
  44. #ifdef EDMA3_DEBUG
    , h$ o6 i8 K$ }& J, Q3 M- ^, \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 R2 j$ `4 T0 [. g5 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % E# Z2 g& W3 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * u4 Z& \0 z8 J8 f& D) z
  48. #else
    + ], e& q/ d" @7 k7 s
  49. #define DMA_PRINTK( x... )
    ! l7 O$ Z& Q) }: a! M5 c
  50. #define DMA_FN_IN
    , g4 k5 }' ^* L# c- R6 k
  51. #define DMA_FN_OUT
    4 _# h7 c* n4 V! F1 j
  52. #endif
    . U( v9 w: y2 j, n9 R

  53. * H) b# s& Y% [: ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 `' X- v8 F, g! [7 C7 G1 ]
  55. #define STATIC_SHIFT                3, F. r9 V% v# X7 K* S3 C' ~/ \7 B
  56. #define TCINTEN_SHIFT               20. o# Q2 g. K. b
  57. #define ITCINTEN_SHIFT              21
    0 L" O8 Y. _  n2 }1 R3 ~# g
  58. #define TCCHEN_SHIFT                225 a/ f# T* K; }0 T. P* b+ g
  59. #define ITCCHEN_SHIFT               23
    + B5 U! ?! C" \6 }" R
  60.   k3 d  Y( J6 q" ^+ {
  61. static volatile int irqraised1 = 0;1 T0 X  g5 w5 T3 L! D; G: S& e
  62. static volatile int irqraised2 = 0;! G( ]( R* N4 N- A

  63. & D' j" \& n. _/ Q" Q# x+ m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 W# @. @0 i6 H$ H% x6 B" V5 J7 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & q2 U* c( ]( y; ]7 ~' A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i& O1 ?  P) q% r1 m. Z( I

  67. ) \. X7 o7 U8 @! L" s* h" d
  68. dma_addr_t dmaphyssrc1 = 0;" ]$ F8 q  S0 x& Y8 R
  69. dma_addr_t dmaphyssrc2 = 0;: ]" Z+ J+ A+ \
  70. dma_addr_t dmaphysdest1 = 0;. E/ D3 Y: D' h( E" \. h7 ~' b
  71. dma_addr_t dmaphysdest2 = 0;
    , j8 q' r( p  z$ h
  72. : r. H* t6 y8 G1 s
  73. char *dmabufsrc1 = NULL;/ D% o5 T$ c$ `8 w; E# n3 W) S
  74. char *dmabufsrc2 = NULL;# U9 b6 N" T$ u1 D
  75. char *dmabufdest1 = NULL;
    4 ]+ p, p) w. I& A- Z- l2 I" d
  76. char *dmabufdest2 = NULL;
    ' y. i# t/ z# g9 b4 ]
  77. - n4 t- Y/ Z7 R; M& L5 e6 N& W8 g, j
  78. static int acnt = 512;: U4 ^, e' d1 n/ i: I: k6 r$ ^
  79. static int bcnt = 8;
      F+ r) H8 `5 g  Y$ F! I4 n4 T# z
  80. static int ccnt = 8;1 x( h5 b& R$ q' t6 f4 P

  81. 4 ?& O: b# Q/ B: z3 S
  82. module_param(acnt, int, S_IRUGO);9 j1 w$ A0 Q( g; s  d' E
  83. module_param(bcnt, int, S_IRUGO);
    5 K6 Z2 p9 u, y" L1 c3 h+ W# C+ h+ @5 X' S* s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ m- [* G# j) F$ a2 O* \4 T* X2 M( r. \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( g4 }- m* k7 B* q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ S; I% Z0 Z' I) ]4 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! p  U8 w0 u8 S) \+ c+ L2 h6 R+ o
4 n5 n  L# k" c" @) z; _- Z: d& B

6 i4 y' ]2 x8 e; e) g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 11:14 , Processed in 0.038769 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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