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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) u* O1 W  b* w1 u9 @4 O1 p  m
  1. [code]EDMA sample test application( o. e$ t+ ?2 D: M
  2. /*  p! P" b9 ~' G  x  B6 v3 i% q
  3. * edma_test.c
    ) [; u( y9 w/ J
  4. ** v. i0 N8 M* K0 ^# u) S7 ?  }
  5. * brief  EDMA3 Test Application
    0 L0 x3 `% G" f' @
  6. *& x1 {8 m! |: C7 w
  7. *   This file contains EDMA3 Test code.+ |9 U, ]+ Y' @; M; b
  8. *# s* W2 [) g3 k2 r; H( Z$ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Z/ }* o+ v5 {) z0 C: s' K* m, F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( `( A- f4 U/ X& T
  11. *         TO CHANGE.
      L1 k6 x6 J1 A. O3 e6 }$ c
  12. *
    4 x) W! M$ m' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' R( h, _% E( h
  14. *
    ( z/ p- I5 _4 O  L5 k; D
  15. * This program is free software; you can redistribute it and/or
    * O9 @6 m+ P3 W2 p9 L& i
  16. * modify it under the terms of the GNU General Public License as& ~1 `5 ~/ z5 S3 v  _7 j
  17. * published by the Free Software Foundation version 2.6 @1 I$ j' ~( N4 D
  18. *7 n% ]. ]) \) s3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 p; ?% g7 ?7 l+ I! y
  20. * kind, whether express or implied; without even the implied warranty: W" j) U/ t  Q* c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 s5 W! S! C3 n% b; i
  22. * GNU General Public License for more details.* b' R# J/ Y' K( u
  23. */: u) A5 I9 t( E/ ^" ?7 o
  24. 3 b- i2 g6 e6 i: V
  25. #include <linux/module.h>4 r; A' s4 d( X
  26. #include <linux/init.h>; a. K6 V8 j! e! l9 A# ^5 M
  27. #include <linux/errno.h>
    4 M* z, Z$ I3 W
  28. #include <linux/types.h>
    4 }' ~( Y" m5 f' |2 G% _
  29. #include <linux/interrupt.h>
    $ l1 F. V) r( E' l2 t
  30. #include <asm/io.h>  Q; A: y+ b; g* ~: F
  31. #include <linux/moduleparam.h>
    7 f( I4 z+ E( O, {# |
  32. #include <linux/sysctl.h>" d! a2 s4 d2 J( o  w
  33. #include <linux/mm.h>6 Y  K0 [7 f7 o2 Z& x3 q  ]2 W# q
  34. #include <linux/dma-mapping.h># Z! a2 s8 r2 x
  35. : `4 N7 V  P6 u2 I5 |, }
  36. #include <mach/memory.h>
    / b* q4 ^/ m; i, Y1 U% p
  37. #include <mach/hardware.h>
    , t! c) M+ X" m. g
  38. #include <mach/irqs.h>
    2 F, W: f# m, e8 ], D: h* f8 z. M
  39. #include <asm/hardware/edma.h># l" M- r! T" A; ]- J) W8 s& H

  40. 5 o( p7 S: Y& E( h3 `
  41. #undef EDMA3_DEBUG& t4 K  a6 Y+ ~) h
  42. /*#define EDMA3_DEBUG*/' c! t5 a% [$ v7 w0 r
  43. 7 G' b7 A3 t; o* r
  44. #ifdef EDMA3_DEBUG
    ( p  G  }& A/ q& r% F9 |9 o3 p! {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 [$ s4 ]* X. J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 [- o# U: g) P0 C! M" }: i, r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % K/ W: u" l0 h. S8 Y, W. V* y$ F
  48. #else
    0 n! \; |8 S4 f
  49. #define DMA_PRINTK( x... )# F& \$ H( p0 Q
  50. #define DMA_FN_IN
    " F% N0 B9 y2 p
  51. #define DMA_FN_OUT
    3 \6 K/ e" Q; ~! v& }! E! ~+ ^
  52. #endif
    6 M9 V+ _  K: }" g
  53. + a* c7 Y1 `7 w2 p  q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! L7 q! W+ T! ?4 I
  55. #define STATIC_SHIFT                3* w- H# _  I4 e% ~/ W& h
  56. #define TCINTEN_SHIFT               20% s2 ]& h: Z3 r$ O
  57. #define ITCINTEN_SHIFT              21; P0 x( Y) x7 {# \$ @% B- z
  58. #define TCCHEN_SHIFT                22# W: a$ i, ?* ]
  59. #define ITCCHEN_SHIFT               23
    3 G: g4 v5 h! q% Y
  60. & V. r, `; A+ L9 b# m) L+ R
  61. static volatile int irqraised1 = 0;
    2 V" ?. d4 n& D/ d0 j7 v
  62. static volatile int irqraised2 = 0;
    9 e8 X5 y0 o3 j- B' C

  63. 9 \1 b& m7 g4 O* E/ \1 G: _3 [; q' w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t& J* v& E" N. P! I: I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H' G) L8 J9 y( n. }: e' k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & d( D% F' k( X; @6 O9 I
  67. ' |- g) k2 S) S/ a5 R, Z/ E8 x" G
  68. dma_addr_t dmaphyssrc1 = 0;/ m# k; Q& d- z" T4 W
  69. dma_addr_t dmaphyssrc2 = 0;
    ( y, f3 u* W5 u. D8 t4 S
  70. dma_addr_t dmaphysdest1 = 0;3 T( g& T% s: s( d, x% Z2 c+ N
  71. dma_addr_t dmaphysdest2 = 0;
    , r) S' x/ N2 R
  72. ( o# u9 K' @! ]' [0 C* E
  73. char *dmabufsrc1 = NULL;
    ! @% m9 q/ z  u
  74. char *dmabufsrc2 = NULL;" V9 O8 W2 Y1 Q+ J- h7 n
  75. char *dmabufdest1 = NULL;, O- H$ D) j' M+ s; d
  76. char *dmabufdest2 = NULL;& _, j5 }% v) S4 f% `
  77. 1 G3 Y8 I  ~9 v" V3 g1 ^( l
  78. static int acnt = 512;
    " E6 P4 u5 K' @+ x, v7 r* m' ~8 M
  79. static int bcnt = 8;
    & B, r3 R/ v6 c3 h- J0 j$ @, }
  80. static int ccnt = 8;
    " v7 V8 D! ^9 {8 \
  81.   e, @3 x9 P8 x
  82. module_param(acnt, int, S_IRUGO);
    ) h+ T, m* f% M
  83. module_param(bcnt, int, S_IRUGO);6 q! ?5 H( ?+ w: y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 p% p* m, V7 ^  S$ P5 ?( P8 Z' {
0 A# D  ]9 _* C. b) ]1 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# l% ?, p) x9 F4 S" _. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* \4 _& x* k" t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- {7 ]7 ]6 A* {" U; j1 v- C9 h2 N' ^( G- y, a* o
$ |5 g: J5 W8 y, E( F, z- d6 t; x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-1 11:15 , Processed in 0.040294 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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