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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : M! H- l0 F  y6 b& W2 o$ o
  1. [code]EDMA sample test application5 O" z1 r* y( J9 S( h( E  B, g
  2. /*- W1 p( A, M0 ~1 [
  3. * edma_test.c8 y" |0 p) N, G
  4. *8 O/ c; h1 L* J) c3 `
  5. * brief  EDMA3 Test Application; k0 }4 S- u1 G2 S4 _
  6. *
    , t% `" k' }3 E/ L
  7. *   This file contains EDMA3 Test code." U% n* @7 [: L+ S6 f8 t
  8. *
    % F& r5 s$ m- c0 p$ U7 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . e7 n/ h2 d" v) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 C! `0 o( E1 o+ n  Q) S
  11. *         TO CHANGE.
    + C- y: H( M' p2 X1 Q+ Q' U
  12. *
    ) G' I7 K: a9 D+ {' b( o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 e: q- [$ M4 p' S5 c4 s- j
  14. *" L/ J. B4 T8 o9 b! R
  15. * This program is free software; you can redistribute it and/or
    * K- @" g5 l, t
  16. * modify it under the terms of the GNU General Public License as. w, f* Z6 D% ?; x; h0 n6 P
  17. * published by the Free Software Foundation version 2.
    $ \& D& ~# _# K( \
  18. *$ R; h7 r) y; ~+ h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& j0 B: S" U3 U9 B& ^
  20. * kind, whether express or implied; without even the implied warranty
    6 M4 i; ~: g8 G- D$ I2 C2 J- J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' I# o. g5 c& p# A! u
  22. * GNU General Public License for more details.( i, \* a# Q" Y6 c: ^2 J
  23. */# [+ C1 w( d" a# ?7 w

  24. 8 c! Q  N) [6 U; Q6 B; U
  25. #include <linux/module.h>
    5 r, {: z: F$ l, }( r( d
  26. #include <linux/init.h>
    ' n- d( e# x% h, T3 M- N" ]& W
  27. #include <linux/errno.h>
    8 b: A! ~5 G  m& w# `9 _& ~7 P
  28. #include <linux/types.h>
    2 P9 `# i; ^! g5 M0 ]3 b
  29. #include <linux/interrupt.h>. g6 Z) m" Y# b/ e
  30. #include <asm/io.h>
    5 A) P* d! c  B+ S. R0 ]0 |4 d
  31. #include <linux/moduleparam.h>
    " r% T7 [8 V  q: I1 m9 U
  32. #include <linux/sysctl.h>- w4 N* E- K9 {  g0 y
  33. #include <linux/mm.h>
    & M6 E  Y6 [. X: [. n! ]7 r
  34. #include <linux/dma-mapping.h>: L* v; P1 f0 W3 u4 d# V
  35. 3 S" E# o. d/ t, \
  36. #include <mach/memory.h>8 b+ ^, u$ Z! G
  37. #include <mach/hardware.h>$ K' q; g! `% f  J3 [+ Z" Z5 `
  38. #include <mach/irqs.h>: r9 {, Q( `5 F9 T# x
  39. #include <asm/hardware/edma.h>
    0 h, Z/ {0 u3 Q& i6 L0 G

  40. 4 Z; l9 B' u5 j$ j6 r, ^
  41. #undef EDMA3_DEBUG
    # c! E9 b; {; y4 r$ a
  42. /*#define EDMA3_DEBUG*/+ `4 P/ _- y% l, x& ^# F, @; E
  43. , Z' W0 f+ ?3 v5 L
  44. #ifdef EDMA3_DEBUG
    7 l' Z; L- V( K6 a4 e" z; Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  Z  e( d' ]! W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- a" Q: E" V4 j  H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! T# z# q, Q4 O- q1 c
  48. #else7 r5 e) x+ F$ V7 q8 F1 J+ j
  49. #define DMA_PRINTK( x... )( h7 a6 K2 `" ^! ?+ C4 V/ ^
  50. #define DMA_FN_IN
    * r) _+ Z: H0 U1 i" a5 a. o7 B
  51. #define DMA_FN_OUT
    # f% D- s9 D: S, q, f9 c
  52. #endif+ n1 l" z" T( d  k  G' m( U8 L- k- O
  53. / q4 c* x3 K9 \- B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- G: j4 o, u7 R
  55. #define STATIC_SHIFT                3% X. [" r  x  i- B4 U! `
  56. #define TCINTEN_SHIFT               202 b9 {$ ?3 \5 d. v9 E- D
  57. #define ITCINTEN_SHIFT              21, j# L! e5 k7 r5 z
  58. #define TCCHEN_SHIFT                22
    8 ^& m  D0 g) L& _- j+ n8 `
  59. #define ITCCHEN_SHIFT               23
    2 v5 F5 i! W. `4 W4 g

  60. # B" S+ L3 q+ ], B7 `3 W8 m
  61. static volatile int irqraised1 = 0;# T2 v! O6 l% a% b& j! y
  62. static volatile int irqraised2 = 0;3 N5 q5 a: M4 t6 E6 t4 K

  63. : S. u/ w5 p$ B7 g0 I! ~: s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% W6 T4 }  {, V' u  a; |* G  F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S% X  B' H" |% k2 `# k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' x0 K  y# P" L2 M+ Z3 E

  67. # l+ P/ U1 z( C0 u4 S) G
  68. dma_addr_t dmaphyssrc1 = 0;9 }7 _5 N; J$ P  F% I. ]6 Q- T
  69. dma_addr_t dmaphyssrc2 = 0;
    * \( ]% j7 J% E: Y/ h' h
  70. dma_addr_t dmaphysdest1 = 0;# W; N/ ]7 W* ?% t6 y3 A6 X
  71. dma_addr_t dmaphysdest2 = 0;! c2 e2 g* c3 A3 \# {

  72. + U1 G0 B9 O+ D* s+ z" @
  73. char *dmabufsrc1 = NULL;
      P  k3 D) g; f- i
  74. char *dmabufsrc2 = NULL;( y: @8 R# k* j5 J$ ~4 a* U# W
  75. char *dmabufdest1 = NULL;
    * ?7 L5 m/ I, N- v6 {& b
  76. char *dmabufdest2 = NULL;
    6 I8 |4 b" ~4 z
  77. * I" Z0 G$ s" c
  78. static int acnt = 512;# [' Q0 Z9 v7 P+ W
  79. static int bcnt = 8;! P& c0 O, m8 z4 B' _1 i
  80. static int ccnt = 8;
    4 \3 h1 H7 ^9 _8 q$ r0 x0 [; \

  81. 3 `6 U4 G3 Z; Z$ v' k
  82. module_param(acnt, int, S_IRUGO);
    8 W* ?1 s  C  F) H- f/ {
  83. module_param(bcnt, int, S_IRUGO);
    $ }* I7 l. {5 N1 s4 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* K; G/ w5 l3 ~- Z0 O. Q& B7 s
5 }' r0 }7 A& e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ X2 o( m- `5 E4 r3 N0 J  m( Y, oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 M) w6 T7 m' q- T. {4 i& Y2 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& W0 j' J8 h" \" ^
4 g  s0 e8 s" q+ P

9 e, M! f' ?+ C7 L8 f- W' \, T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 10:31 , Processed in 0.038998 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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