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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( Y) P; Y- ^9 Y4 Z
  1. [code]EDMA sample test application5 `$ D: s0 o* n& }! l# j
  2. /*
    ( A* O4 ?2 V4 }. x
  3. * edma_test.c# _* `8 _/ z  L$ b
  4. *( {: ^+ K  F! C$ b0 v* Z, h
  5. * brief  EDMA3 Test Application4 N6 ^6 [  M9 G4 {2 F: r
  6. *# n" O0 T5 B7 V
  7. *   This file contains EDMA3 Test code.
    / B7 H, @2 c* ^2 `7 I  {
  8. *
    9 q& v/ T. ?; \+ a& t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 {' F0 ]3 G. k: G" I/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ q" m# {2 {. w+ L# c  n- N3 Q6 X  Y
  11. *         TO CHANGE.
    5 N8 x/ V7 R6 N6 o. V( i! V' s6 r
  12. *
    4 }( H/ S+ W0 l8 j2 D5 F: x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- H, X6 W# a/ O  z" [/ o2 B" @
  14. *& t! f, F: g9 R) s% c8 s
  15. * This program is free software; you can redistribute it and/or3 X+ N9 g' l- }# U$ [; g
  16. * modify it under the terms of the GNU General Public License as
    0 x& v  y4 F# ]+ D% G) Q
  17. * published by the Free Software Foundation version 2.% L6 y+ q/ _; X* t- X/ i, K/ t
  18. *
    9 i6 @* W/ ~+ e( |( O% D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 T6 i& W5 ~2 ?, S# Y
  20. * kind, whether express or implied; without even the implied warranty) M. E: h5 O* O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( m5 V+ @0 E6 U4 y
  22. * GNU General Public License for more details.& Q" {& M$ I2 S2 c
  23. */# z( t% h9 c' Q9 I: y" Z

  24. / ~& o/ d! ^& c0 P2 @5 ^0 j/ m
  25. #include <linux/module.h>
    9 O6 U% }" v" L2 a* p
  26. #include <linux/init.h>: z! {# H) O0 \9 }
  27. #include <linux/errno.h>
    6 J+ P3 q/ m, |0 @
  28. #include <linux/types.h>, a( n. d9 f7 k9 g$ U( F
  29. #include <linux/interrupt.h>4 v9 {, a1 t/ ]+ C
  30. #include <asm/io.h>
    1 q3 u/ R% U3 l9 W
  31. #include <linux/moduleparam.h>) w5 }. ~, c$ Z2 d0 Z( D! I/ c/ ^
  32. #include <linux/sysctl.h>; v/ k5 s6 X) b1 W6 e0 |
  33. #include <linux/mm.h>
    1 }& |7 Y# X6 F& q
  34. #include <linux/dma-mapping.h>0 m- P8 R4 q7 {' M9 P% @4 ^$ j  B
  35. ) O- c" E* r7 o" t/ p0 [: r
  36. #include <mach/memory.h>2 Q! W/ q) m5 c/ g* [4 c
  37. #include <mach/hardware.h>% T& Z5 n* i, |. W
  38. #include <mach/irqs.h>
      |; y  Y; G: H& R
  39. #include <asm/hardware/edma.h>" \" `: `* B% x4 `1 K

  40. 6 j0 F! O4 ]& J' i$ @+ G" u$ r
  41. #undef EDMA3_DEBUG' e6 E) C+ i, R. t
  42. /*#define EDMA3_DEBUG*/7 t* S- p- G8 |& H7 ^4 O) k
  43. 0 |: M" v9 C# g1 B: T
  44. #ifdef EDMA3_DEBUG0 j+ h. ~" e. b$ O+ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ S9 r! T& X! g( [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ^3 d# `+ ~$ X+ l. W) H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 W1 n+ w5 P3 \
  48. #else/ m& q% f5 C3 [
  49. #define DMA_PRINTK( x... )3 @2 k6 [) L4 L9 l. x" Z3 b2 f1 w
  50. #define DMA_FN_IN
    6 U1 M4 q" L9 `
  51. #define DMA_FN_OUT# r. e: S5 o, I! b
  52. #endif2 V$ R$ H5 I$ U6 P; U
  53. . k* c( o2 ~4 `5 {; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  L* u; C2 F6 {& }+ ^. l
  55. #define STATIC_SHIFT                3
    6 n% x, \5 I1 w% u: a
  56. #define TCINTEN_SHIFT               205 x# J: E! I* ]1 ]7 B$ I
  57. #define ITCINTEN_SHIFT              21
    7 ?2 b4 ^" Q5 O- o5 o
  58. #define TCCHEN_SHIFT                22+ o2 a+ m5 q3 y$ c8 F9 h) G: r
  59. #define ITCCHEN_SHIFT               23! O' P8 K  A1 p. g- B
  60. 0 ^5 K  B7 d* S. k# \8 Y3 L  S, ~, x
  61. static volatile int irqraised1 = 0;
    ) I( R0 i, ~9 Q6 \
  62. static volatile int irqraised2 = 0;4 y$ U/ m6 r! l/ {0 @+ B

  63. 7 H6 L  s: k5 m7 ~. u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ?3 f/ L3 k) E0 @) G: H. y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ?7 P5 m5 x+ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E$ A* M/ h3 k* B  q

  67. ) w- t3 B! y) t2 H$ }2 }# ]7 X: F
  68. dma_addr_t dmaphyssrc1 = 0;
    * g# _6 V2 R5 Z3 \* }# w1 h# q5 _
  69. dma_addr_t dmaphyssrc2 = 0;3 E% t; j, W/ U2 S5 q7 z
  70. dma_addr_t dmaphysdest1 = 0;- J# H/ T9 i6 A2 ]  O& _1 n
  71. dma_addr_t dmaphysdest2 = 0;$ w" Q6 g' x2 s1 @/ @% y
  72. ( y3 p! E- Y# v. m1 |2 }
  73. char *dmabufsrc1 = NULL;+ z1 |5 T! z8 g+ j: K
  74. char *dmabufsrc2 = NULL;
    + S! Q. U% Q) o+ Y+ z
  75. char *dmabufdest1 = NULL;
    1 P, r2 I7 Y$ g
  76. char *dmabufdest2 = NULL;+ f4 C) {! T( M' d; E; y6 o/ Q

  77. ! {% }1 j0 z( w% G/ h6 i; R+ Q( L, c
  78. static int acnt = 512;
    8 C, v/ o# m, ?& R# F
  79. static int bcnt = 8;; e+ i5 O$ ]- L* k5 ?' n
  80. static int ccnt = 8;* }# i. K% {- A& {

  81. 8 C" j4 P. m& E* Y
  82. module_param(acnt, int, S_IRUGO);
    3 `+ R0 O0 f& M7 ?0 f
  83. module_param(bcnt, int, S_IRUGO);2 ~( D$ C+ ^; b- F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 x, m! `, A6 f+ L2 E; C% G% \2 L2 \9 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 }" Q9 m5 ^& ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: I$ G$ v2 i6 u" |4 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 @, K" g5 h- u# [* d* H4 A+ n1 k' o7 O" t8 E9 h

! n* ]6 \6 f0 A8 q* D$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 06:31 , Processed in 0.039686 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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