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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 k. U! P' y+ ^( B" }: j1 ^' s
  1. [code]EDMA sample test application
    7 j% [4 e2 n- y5 S7 R' u7 B
  2. /*; s& U0 x7 F' t! H
  3. * edma_test.c0 m, O6 F! b" b9 Q# j& y
  4. *
    . z. F' l/ y( Y  Z
  5. * brief  EDMA3 Test Application5 [7 U- @4 M1 W" N; U! Y# x, b
  6. *+ v- ?) `$ k: n) R; M  A! y
  7. *   This file contains EDMA3 Test code.4 Y) G5 b5 l% B, X! j. M
  8. *
    7 h3 b! R3 P4 t2 Q8 \  q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, {, {" r: Q. L+ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - n4 j& B% i! A" }. N. z
  11. *         TO CHANGE.
    9 f" K! v' ?- S, B
  12. *
    9 G. p1 G& H, l: |. E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      \6 w) E# F% U* N
  14. *
    5 g! B$ I4 \3 W* Y& Z7 ?' N
  15. * This program is free software; you can redistribute it and/or+ u. \$ ?; X' p  e
  16. * modify it under the terms of the GNU General Public License as9 J- a& F6 C) U: V
  17. * published by the Free Software Foundation version 2.1 }1 {0 s# \& S+ [+ h8 @$ [+ X) T4 T
  18. */ K5 l, `0 e- G* |0 t- k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# n" N  [( J2 Y1 S' Q
  20. * kind, whether express or implied; without even the implied warranty2 z" H, R5 {, H1 H2 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 u0 S7 F# M& o1 I; a* D7 i
  22. * GNU General Public License for more details." C7 n+ W3 V3 R! m! C% j
  23. */# O( S4 Q" f. n

  24. % W8 x. R& b0 ^# @. p1 D- w0 O
  25. #include <linux/module.h>
    ( s1 Y+ \  @/ ]! H" a7 |/ J
  26. #include <linux/init.h>
    ( g: K. e; i. p  v" E* L8 T# J# d# ?
  27. #include <linux/errno.h>
    6 _* L9 G8 g0 p" P, U
  28. #include <linux/types.h>) u7 F0 m7 N5 B
  29. #include <linux/interrupt.h>
    8 J+ m$ S/ O; W; p$ ~* p3 Q
  30. #include <asm/io.h>0 n/ a  J4 c7 B9 l6 N1 F
  31. #include <linux/moduleparam.h>
    6 H4 M: Z/ q& t2 x# P
  32. #include <linux/sysctl.h>
    ( ^6 q9 w' D' l( F/ p
  33. #include <linux/mm.h>
    ( c7 H0 _: c9 P4 f. t
  34. #include <linux/dma-mapping.h>2 [. m. |4 _+ t- _  |
  35. 1 {" Y2 A& f$ `! `6 L$ y4 [9 e
  36. #include <mach/memory.h>
    3 Y. U$ {* b+ w0 X) O# p
  37. #include <mach/hardware.h>
    9 v' {8 d/ y" _) J3 H$ c% j
  38. #include <mach/irqs.h>* \1 a/ _% G0 h7 S* i
  39. #include <asm/hardware/edma.h>. [  ?$ k2 y  t& I

  40. - b/ ^& z2 e5 P; B9 ~3 r( @+ ~
  41. #undef EDMA3_DEBUG$ s  j1 h; a  e! B4 Q) c
  42. /*#define EDMA3_DEBUG*/; Z! b3 p- _* G' b$ Y5 _
  43. 6 {7 S: ]) j" m" E8 j9 P/ p1 E
  44. #ifdef EDMA3_DEBUG8 Q/ e4 N% M( |9 J7 [, U, C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ c# c- d" l" n( ]3 }- H7 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Y" a9 g0 I  i* h3 m# f7 L/ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' l. X. n, ]6 h. F
  48. #else
    & t1 y3 V% w6 t0 ^  x
  49. #define DMA_PRINTK( x... )+ _: ]. ^8 K% ~0 E, M+ h+ h
  50. #define DMA_FN_IN
    5 Z' n8 N. X* |0 E) `4 n8 h
  51. #define DMA_FN_OUT8 V( M3 E% {1 e" ^* I
  52. #endif' {, u1 t5 n. A9 J+ ]' ~( Z
  53. 2 w8 S' L( T6 T! f* v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): U" Q$ ^3 X- }4 {+ _; f: H
  55. #define STATIC_SHIFT                30 w8 _( f4 }1 ]; c9 F
  56. #define TCINTEN_SHIFT               20
    ( X: W8 Z+ S; {; r0 Z! y3 M
  57. #define ITCINTEN_SHIFT              21
    1 l4 I  z  ~! Z3 `
  58. #define TCCHEN_SHIFT                22
    0 u& G3 U! p: ^8 F) Y0 X9 F  r
  59. #define ITCCHEN_SHIFT               23
    1 V+ {! X4 M) n1 j0 y' N

  60. 5 f3 a' X1 J- [2 ?2 v1 ~* A1 E. r8 r
  61. static volatile int irqraised1 = 0;
      `) L& E  U/ I; l  _! d1 b
  62. static volatile int irqraised2 = 0;
    * @5 v3 ?; m5 r; p. q

  63. 3 y7 s9 J# d8 w. `! v* \1 a: f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( H7 g6 n" G0 Q1 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * z8 ?) n/ y& Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. P! ?8 w" q4 R
  67. + l0 L( }" w# ?2 D0 @
  68. dma_addr_t dmaphyssrc1 = 0;
    1 A- k. Y  r! q( r1 s, G% u5 g0 P
  69. dma_addr_t dmaphyssrc2 = 0;
    1 K4 \/ i' i( |6 r
  70. dma_addr_t dmaphysdest1 = 0;
    8 |. F  i" B# E9 L8 ^: g* j
  71. dma_addr_t dmaphysdest2 = 0;# N' r0 z9 i# p& u
  72. ! H1 l5 D2 G" {6 p, h% |# g% D
  73. char *dmabufsrc1 = NULL;
    ; ]  V3 h, w7 s2 {
  74. char *dmabufsrc2 = NULL;
      Z2 s! H6 V& K2 m* b; X$ H
  75. char *dmabufdest1 = NULL;1 f9 C3 [2 m7 r
  76. char *dmabufdest2 = NULL;
    ! Q& h( p$ K% J0 ^+ W

  77. # [, F' a9 I$ m' ^! Z- G3 i
  78. static int acnt = 512;
    ' Y% p/ j0 w- C. O9 f: l
  79. static int bcnt = 8;/ k8 r5 g4 ]9 Z
  80. static int ccnt = 8;4 s/ U' ?  N( L) H4 ?

  81. 4 z0 K4 X( m- K9 d9 ?$ \
  82. module_param(acnt, int, S_IRUGO);5 X/ k& s' j* d9 w4 c
  83. module_param(bcnt, int, S_IRUGO);
    & ^2 Z4 I) G8 a4 }/ L7 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 a5 U0 W1 p  J5 r8 r3 n9 C/ n- W1 |

$ U+ L7 i( t0 p6 b  v7 C9 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O$ l* x. u; o' [0 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]+ b. t8 u8 w! U) ~1 J; p' c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- s* s$ K' S3 |! [8 u5 e

4 e8 }: e* w# `) h8 Y. S* Q6 t. Z9 J: Q4 ?6 E& g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 19:45 , Processed in 0.049577 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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