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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ S' z' h6 w. p9 e0 z6 W  U
  1. [code]EDMA sample test application! `4 q8 I# p$ S$ X. H. g% M
  2. /*
    . M& [* @  u. G, \) I
  3. * edma_test.c( G* |$ X9 X6 ^8 p
  4. *
    * k5 `. I/ t) E
  5. * brief  EDMA3 Test Application$ G9 j) J3 N( ]2 u. q9 Y( F" ?
  6. *
    4 g! @0 M+ `! ^1 U
  7. *   This file contains EDMA3 Test code.# w9 I- c$ j# |$ @" ]2 S
  8. *! u8 i; D* O8 M2 `9 U' B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! j3 s6 J9 G! O9 X% e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 d1 d/ ?. _1 N7 r# a! m, P/ ]+ \6 N3 _
  11. *         TO CHANGE., v, C0 N' G3 V& ?0 R3 F/ I  u
  12. *- x1 t9 |/ z" X) ]- ]4 |  Y0 ?$ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]4 f5 Y7 i* B% I7 M
  14. *2 C2 Z0 e6 X8 F8 _+ f7 N4 `) m
  15. * This program is free software; you can redistribute it and/or$ L/ h' b7 \1 I! _+ w
  16. * modify it under the terms of the GNU General Public License as2 J( t! H+ l% V" C
  17. * published by the Free Software Foundation version 2.
    $ L; |! N3 p: d* r
  18. *
    / O: F% A! m( V+ I9 e/ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 y+ i3 x5 g* Z4 V2 @5 Y
  20. * kind, whether express or implied; without even the implied warranty9 k0 F# j3 ?' b$ J( S/ \$ g  x9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: u+ m* S6 Q; J
  22. * GNU General Public License for more details., x- l1 N& f4 Q3 A
  23. */
      }8 a/ Z# {, u+ u" J

  24. / c$ m" P5 K$ `" k0 {' L5 L) S; D; [
  25. #include <linux/module.h>
    % B4 ]) {1 w  v; q: o
  26. #include <linux/init.h>
    4 }  e# h( C" K0 D* Q1 @
  27. #include <linux/errno.h>5 D9 q5 H8 I  Z0 y  E. I2 q; h  V' q
  28. #include <linux/types.h>2 F0 i% G- K4 _- b9 n+ T
  29. #include <linux/interrupt.h>; R( |7 a% n) G, U! R" S+ x
  30. #include <asm/io.h>, d5 i% d; Q7 o( z7 b
  31. #include <linux/moduleparam.h>
    " p  Z8 M9 Q% x1 w; h7 y' _0 f" j
  32. #include <linux/sysctl.h>
    : u1 E; W0 j2 k' r
  33. #include <linux/mm.h>( I: C; W+ l) w2 H
  34. #include <linux/dma-mapping.h>+ {& V) ^# ~: R' |7 r

  35. 6 L" g1 m& O/ H3 I5 H
  36. #include <mach/memory.h>" V- y/ D% _: N2 q9 Z0 E
  37. #include <mach/hardware.h>
    : g9 O- e( ]$ ]' c: \
  38. #include <mach/irqs.h>7 I) G- W. o% M3 b: t5 N
  39. #include <asm/hardware/edma.h>1 a2 F; w0 T' v2 R6 q
  40. - F5 M0 q% {, D# @) T
  41. #undef EDMA3_DEBUG
    ( v! j% S3 j6 X& q& j* v& ]7 D
  42. /*#define EDMA3_DEBUG*// O7 J6 L# ]+ D- o  |, [
  43. 5 m/ P: r6 x: S+ X
  44. #ifdef EDMA3_DEBUG
    6 D0 V% s5 ]& R+ t- _; D* _( q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 U0 y  C6 k& G6 Q" z! }! f2 @+ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& b" a! P- x* k8 ]# L% W( o8 S+ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # t/ e: u7 T0 k, A1 `
  48. #else- a' x' D9 l( \, y
  49. #define DMA_PRINTK( x... )0 q) d. ?# c7 V5 s- i
  50. #define DMA_FN_IN! C- ^/ ~9 a) i0 I6 I0 _
  51. #define DMA_FN_OUT6 ^5 e% k7 X( u& P$ R1 }
  52. #endif
    * ]" B( [9 j! u9 H9 X
  53. 2 a! `5 o- E$ c: }7 q; E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * e$ _; I: u5 @  s% s% F' V
  55. #define STATIC_SHIFT                3
    + N2 y) Y" Y- V- T7 o4 s
  56. #define TCINTEN_SHIFT               20
    3 H) p$ m7 f8 b+ I" [  h
  57. #define ITCINTEN_SHIFT              21- X( l$ f# P8 W( w/ Q  X
  58. #define TCCHEN_SHIFT                22/ x" R$ F5 r% P& I
  59. #define ITCCHEN_SHIFT               23
    9 l( F5 O7 Y9 A$ H* @* F; d- j4 i
  60. ; d* J" |4 C/ b' G0 D, v* b
  61. static volatile int irqraised1 = 0;
    " B. v& z2 h7 \* M1 H
  62. static volatile int irqraised2 = 0;
    2 b* k' d: `2 N: v3 `- \
  63. 9 L; K5 L- N6 n% n/ f0 s. Y0 C6 [% P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E6 Z1 Z9 Q) k* E& T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + A3 R! s) t2 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y# Z/ [& k0 ^! v2 D

  67. 1 _# ]- k+ m& w9 g/ h. z$ c
  68. dma_addr_t dmaphyssrc1 = 0;
    0 R9 t0 K8 }, W! n# ^4 I4 |
  69. dma_addr_t dmaphyssrc2 = 0;
    & k, Q% ]& [  W$ Q6 {# t- h
  70. dma_addr_t dmaphysdest1 = 0;
    4 @# w" {4 x  B- {& b! S
  71. dma_addr_t dmaphysdest2 = 0;7 U; k, P: Y0 }6 @! z8 P
  72. & ?% a& Q# `9 \7 P% Z  y8 c
  73. char *dmabufsrc1 = NULL;
    3 Q& H+ G; j; \
  74. char *dmabufsrc2 = NULL;
    ! d" z3 i6 D& q; t! T- V
  75. char *dmabufdest1 = NULL;
    ! S7 U6 U% u4 H/ c; D4 S0 i& n
  76. char *dmabufdest2 = NULL;2 q; Y) @; m4 a3 F) Y' X8 \
  77.   ]- u8 P8 l+ D7 Q! C. O( V0 w
  78. static int acnt = 512;
    ! W- l0 g- b1 Q& n
  79. static int bcnt = 8;
    0 t( J' F, r- t' ?9 j3 A
  80. static int ccnt = 8;
    3 {% s1 B5 p0 G4 D7 _

  81. # y* G1 Z4 p8 S7 k# q: I
  82. module_param(acnt, int, S_IRUGO);6 v, k3 h5 y- x1 W
  83. module_param(bcnt, int, S_IRUGO);" b+ H7 ^/ T. m# {# ^. o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ E2 w0 J) f# X$ w
- x+ X& S7 N( O$ Q8 D$ T4 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# x+ ?7 F/ e3 r' \$ N  xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R3 @) I( H1 }, H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ?% M4 W2 g6 l7 M

/ |, P: T0 i- p: N* ~6 J
# _& e+ j* M& k: v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 18:56 , Processed in 0.055427 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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