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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 g6 M  \' ~5 E" G, f
  1. [code]EDMA sample test application( j* ^# h! e- C
  2. /*
    ; t& j. X/ B4 [5 F
  3. * edma_test.c
    % E- g% b) C; l' d$ u! ]2 v+ H
  4. *' g- I" G7 e: J
  5. * brief  EDMA3 Test Application! J3 L/ N6 w  n; p7 q
  6. */ J: {0 a. O+ d2 L, e; @
  7. *   This file contains EDMA3 Test code.
    + L- L6 Y( B  V+ T) n* A& l! K
  8. *# l% l" ?2 b! ], S7 z* w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% U  T. b6 W9 g' \, g) l% e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! u, ?. T1 R0 H
  11. *         TO CHANGE.
    & N2 P/ J5 S. |* e
  12. *
    4 r" |4 i) e+ F3 i8 u+ z3 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. x/ L  O8 n% ^
  14. *1 f# s  H8 }/ ]# n+ G
  15. * This program is free software; you can redistribute it and/or
    & ~4 s% b& i* I/ A$ o% i# l
  16. * modify it under the terms of the GNU General Public License as
    - q" x) ?7 Q$ k. s- O8 Q+ W9 [0 Q) u
  17. * published by the Free Software Foundation version 2.
    $ s4 Z0 S3 e: s, }5 G
  18. *& H$ k8 s; ^+ D" K1 Q1 q( D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- [! [; j+ ]5 Y5 B* W% }. k& M0 j
  20. * kind, whether express or implied; without even the implied warranty
    ; n2 s; b3 `5 k( \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 {9 X0 Z: L# H
  22. * GNU General Public License for more details.
    $ j  v% f8 a7 t0 @1 M3 }
  23. */8 {- ]4 O# V' F' W# N

  24. ! P/ f6 c9 u+ N: I' K% m# ]
  25. #include <linux/module.h>
    : T; J' n9 L# P, y
  26. #include <linux/init.h>. R4 K( s3 `/ W: u# c, Q: X
  27. #include <linux/errno.h>% l  Z. Q" t. H
  28. #include <linux/types.h>2 L# `  T) r' }& m4 I
  29. #include <linux/interrupt.h>
    . s. K) r; Z. m& o; ~, n: E
  30. #include <asm/io.h>* G9 j- Y) |% |6 D, M& g6 v6 D0 x
  31. #include <linux/moduleparam.h>
    6 v* G. a! E4 w- U: B
  32. #include <linux/sysctl.h># y8 p5 |. q9 z
  33. #include <linux/mm.h>
    2 b4 `; l' H# F  I+ v& F, A+ z
  34. #include <linux/dma-mapping.h>
    4 ^' `) y( F. u8 a) t2 l

  35. 3 j+ T4 Y; k) q# D& s: N8 P
  36. #include <mach/memory.h>
    2 X7 J/ T1 L: i$ X6 u1 }- Z
  37. #include <mach/hardware.h>
    * o1 C$ d& C2 S6 R
  38. #include <mach/irqs.h>1 v, k  n& }0 ^
  39. #include <asm/hardware/edma.h>- C( J1 @4 U2 j7 V3 N0 ?& ?
  40. 3 _) p8 ]  P; j
  41. #undef EDMA3_DEBUG
    ; J  C( l- @6 v3 r/ I
  42. /*#define EDMA3_DEBUG*/8 P' z/ J$ k( }; j8 v
  43. 6 h( k% h7 S" A9 ~
  44. #ifdef EDMA3_DEBUG
    - A7 J/ C. p- j: Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 j' r( [  e& w# ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 ]; g! d: t' L8 G  }- a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ H) H7 m, `8 }' j, A9 Z% E" W6 r
  48. #else
    # e$ k6 q, H4 m+ i* W
  49. #define DMA_PRINTK( x... )
    5 m& G5 N+ A" _3 E& q" k& B
  50. #define DMA_FN_IN
    6 c6 e, u' O5 G& l. q) Z
  51. #define DMA_FN_OUT1 D$ t0 ?6 x; k. \) c' _/ l
  52. #endif
    ; E, q7 ~/ C0 r& M! |
  53. ! q( U" @, z/ D6 u7 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 ~# [  A/ X0 y5 P
  55. #define STATIC_SHIFT                3! }0 T2 {" F5 t; j# Y
  56. #define TCINTEN_SHIFT               20
    " e+ J2 r/ i8 J2 X3 S, R6 S
  57. #define ITCINTEN_SHIFT              21% L. j" y2 D) f' ?+ j* R
  58. #define TCCHEN_SHIFT                228 x8 m/ T, Q  ^! d6 d
  59. #define ITCCHEN_SHIFT               23
    - H2 j( Y& [1 W: s* }( W
  60. ; m% o2 D+ l4 P
  61. static volatile int irqraised1 = 0;# T) m0 ?% F$ @5 b. V# p
  62. static volatile int irqraised2 = 0;3 F, s. l# P8 c0 x
  63. ; C! N$ K. v4 S9 b0 ]; j$ w4 m! S3 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 n+ I& w7 y2 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ^  l0 K' i) \) q) k, v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! W7 c3 s3 U3 {* a' w
  67. $ ]  O( i8 h+ q( w
  68. dma_addr_t dmaphyssrc1 = 0;$ K; C" t! I1 y, |4 U" p. W# q/ A
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ^9 l5 L+ i- O
  70. dma_addr_t dmaphysdest1 = 0;* r8 d, y+ W, V" c
  71. dma_addr_t dmaphysdest2 = 0;5 X# |# [+ Z) y9 j  c. f

  72. % x6 r' Z/ ]* t8 e3 n, r
  73. char *dmabufsrc1 = NULL;
    , I) j5 {- Q" L8 @3 i) f
  74. char *dmabufsrc2 = NULL;
    " |' \5 r: ?5 J/ J4 ^1 y7 Y
  75. char *dmabufdest1 = NULL;( H+ n3 G9 ]" H- @! `  _
  76. char *dmabufdest2 = NULL;5 x. h: ~, `$ i
  77. : ~0 v4 E% k) D! g6 B
  78. static int acnt = 512;9 ]3 |8 A+ S" V9 D4 S+ H- _
  79. static int bcnt = 8;# o8 m/ R8 f2 g0 K8 Z, L
  80. static int ccnt = 8;
    . d, V% P9 e9 l4 ]! n

  81. ; L. M& `% e9 W/ o
  82. module_param(acnt, int, S_IRUGO);
    6 Q  y; B4 g3 A, W
  83. module_param(bcnt, int, S_IRUGO);
    : f, d% U- @! z* K2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ C  ~; v( J  K

! ?) X, f' Y1 f: {% c: w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% X# s! f! O. N- ^2 Y9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 Y7 g! m3 o. U0 C% I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 a2 |$ L- s  S6 u0 Y' S

( D* e  U% r7 t& S) s  p' `) j' K
7 X8 |  v* A' g6 M+ O4 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-5 07:26 , Processed in 0.041359 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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