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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `/ v& b; |2 f2 q+ G) i# I' z
  1. [code]EDMA sample test application
    3 C6 [( y( E1 M( u" b9 X
  2. /*
    2 {5 z3 J+ q! N9 O# y& V0 D, T6 |
  3. * edma_test.c
    2 u( K& ^6 T6 W5 ]* \
  4. *
    7 V$ a& e5 n+ _1 P5 i- ?. S
  5. * brief  EDMA3 Test Application
    2 q, D5 I3 O/ u+ P3 _$ ]6 a5 D+ J
  6. *$ T$ s9 x: Z: N" |- ]7 j5 c" n
  7. *   This file contains EDMA3 Test code.
    ) j" t, p4 U( J6 v
  8. *) c6 L8 y- B6 p8 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . _5 |9 l- p, b7 Z0 Q9 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % l# p. l% T8 {5 ~9 h7 d5 S* O5 x" Z: M
  11. *         TO CHANGE.
    0 K- Y% g- ~3 I4 s. P* ]
  12. *" X, W5 H5 r$ b9 K8 L/ i$ T& W, a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 K2 ?/ G- S3 F
  14. *
    / K, N( h4 a$ S3 ?  j7 a# T* Z  I
  15. * This program is free software; you can redistribute it and/or. I" v' U) j. x! E# a
  16. * modify it under the terms of the GNU General Public License as
    # ]; _$ f4 U/ V4 j' x# q
  17. * published by the Free Software Foundation version 2.
    4 |$ {: x( P$ j
  18. *) p$ L% h/ `& r1 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 K3 L0 M0 D( Z) J* {4 \/ O
  20. * kind, whether express or implied; without even the implied warranty
    * w: M$ }% O/ p0 N9 ~4 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 X6 }0 v  O0 c- G9 N
  22. * GNU General Public License for more details.
    * o; e" F1 w3 M; d; x) A, C
  23. */
    8 E5 E1 L! B; i, {5 ]
  24. 8 ~8 J6 n0 I+ u4 k6 k9 M" a
  25. #include <linux/module.h>  X: ~/ |+ S( [7 |. P4 @2 v
  26. #include <linux/init.h>
    - K6 y( `/ w& B
  27. #include <linux/errno.h>
    " y" r# ?5 X: a( k# ]. o: q1 u+ _7 k
  28. #include <linux/types.h>
    ; c0 _. _4 F  B* y6 q& c
  29. #include <linux/interrupt.h>2 k% F. ]0 w4 P3 a& d
  30. #include <asm/io.h>- o$ A6 k* W2 B" v  S: z
  31. #include <linux/moduleparam.h>1 E. ?9 U9 X: g' D- I+ \% S
  32. #include <linux/sysctl.h>
    & v$ D- ?# j5 n5 Y1 X6 h
  33. #include <linux/mm.h>4 K3 X0 v: u4 w8 B$ F. n) x
  34. #include <linux/dma-mapping.h>! \/ g# ?8 L' b7 t" m3 W& D

  35. ! n! X/ {3 H4 f  j
  36. #include <mach/memory.h>
    1 r) K8 t& J2 T- \7 L
  37. #include <mach/hardware.h>
    % J  I. ]1 s4 U% E' g! U5 \
  38. #include <mach/irqs.h>
    % w6 u: e* r( V" f  M: r3 s
  39. #include <asm/hardware/edma.h>
    : T; Q/ f9 g$ U' Y9 U9 r

  40. ; z7 b$ [" P) m7 L6 i0 c6 E8 A' b& P4 x( O
  41. #undef EDMA3_DEBUG
    & s: N. Q4 g  u4 C6 X* A: V+ V
  42. /*#define EDMA3_DEBUG*/
    2 v! n' Z" D. F5 p) h) b4 n& Z
  43. ; B: K, Z" C; I* ~- m2 ~( E
  44. #ifdef EDMA3_DEBUG+ N! R5 F! N" W9 V5 _4 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& c: B# ]( A! p# Y' n! s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 j5 i* L& j0 ]# `- n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 R2 E, r2 D- u/ l) p& A- A
  48. #else
    9 e3 h2 u& D2 u8 X6 N/ z
  49. #define DMA_PRINTK( x... )
    & I9 T. S7 }3 K7 N; Y, H0 g
  50. #define DMA_FN_IN4 v! h: T( U: H, F
  51. #define DMA_FN_OUT
    9 G: u, ]+ m) u6 L6 A* R- Z
  52. #endif* C$ U3 Z% b, i4 U
  53. ( T! d7 R/ I0 t( e( k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% M$ a, Y6 a& m' T/ T+ T* s2 g9 r
  55. #define STATIC_SHIFT                3* d3 w3 f* D+ l4 g3 v' a* _
  56. #define TCINTEN_SHIFT               20
    5 B" p4 D. Z& S! p/ s
  57. #define ITCINTEN_SHIFT              21. C; i7 P/ c) v2 @5 m
  58. #define TCCHEN_SHIFT                22
    2 v" N" B6 r  M: W
  59. #define ITCCHEN_SHIFT               239 S- d. Y& P' ]* ^( L' n

  60. , S* @3 ?; W6 L( p9 l
  61. static volatile int irqraised1 = 0;
    6 `8 F9 }. v. b/ T$ [
  62. static volatile int irqraised2 = 0;
    , S7 R* N+ j6 I. D! r

  63. ' T% A& O( ^+ r$ @: S% s. X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 P& F4 C4 f; Y* d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [4 Q8 w: o* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h, s8 |8 K. Y: P4 M, n' Y" c
  67. 2 @; k6 D! I1 m/ V
  68. dma_addr_t dmaphyssrc1 = 0;
    + A' t2 Z7 f7 s! o* r: h8 G1 x
  69. dma_addr_t dmaphyssrc2 = 0;
    5 `+ S0 r+ l% D6 a( D( c" M
  70. dma_addr_t dmaphysdest1 = 0;( ]  H/ q: y; L* Z
  71. dma_addr_t dmaphysdest2 = 0;
    & D4 U3 M) A1 u% ~- w

  72. 9 j8 `4 U* e  m# G: K$ ?
  73. char *dmabufsrc1 = NULL;* ]+ r) @- ?4 q8 \
  74. char *dmabufsrc2 = NULL;. i1 P" A  C6 @5 u/ M
  75. char *dmabufdest1 = NULL;1 @' o* |' B# k) ~
  76. char *dmabufdest2 = NULL;
    1 t* D4 o; M8 X$ O; o

  77. 1 x8 a! S2 n2 Z2 ^
  78. static int acnt = 512;7 G6 o$ y" S3 z$ b! Y" T
  79. static int bcnt = 8;$ d2 r9 K! j& V3 ?5 h9 S: }( r
  80. static int ccnt = 8;
    ' S5 X* k# m. y, E  h( \* z  i

  81. 3 f' z) k' A& @' i$ S7 Q, _
  82. module_param(acnt, int, S_IRUGO);
    , x- v/ Z2 e/ ~* p- L4 q! T/ i; v
  83. module_param(bcnt, int, S_IRUGO);  R& H# ]. J1 Z2 ^9 U7 y* a2 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ A: c+ Y: s. a1 N$ J

2 i. `9 d. n: r( Z( A. b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d, \$ P+ J) r4 s! X" k2 e0 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 S' x/ y5 ]. j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& P- i3 g6 x  @8 P! m9 Q

( A' |- t" Y, o
' {; s3 X: f! k& N/ v; `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 02:13 , Processed in 0.039453 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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