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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d5 R2 x) Y8 X' n. h- }. H
  1. [code]EDMA sample test application& E% P! y# C4 \! d* c/ ]% n" R
  2. /*
    * p* z, S5 ]: G) u1 w5 n
  3. * edma_test.c. e" g2 }  R3 x# H4 T$ T0 \0 t3 p. V
  4. *
    4 Y5 x# U1 C3 c5 g5 K8 r4 u
  5. * brief  EDMA3 Test Application
    - H" \+ E  Z; H9 j- A: h' a
  6. *
    # d3 _' }) I0 R- g
  7. *   This file contains EDMA3 Test code.) G$ r. o0 Z5 X6 g) n
  8. *
    : k( J) u3 P6 E& t4 _# e, F( ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 T( s0 g6 \5 I" }5 P+ ^1 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & n+ a$ J3 i' F, d6 _5 ?
  11. *         TO CHANGE.0 r! q: \; o' P& p. J
  12. *
    6 A8 ]% ^( v1 Q- a8 n3 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 r9 D! Q; X) z: N$ W! k
  14. *
    $ ~& L0 h4 P6 m
  15. * This program is free software; you can redistribute it and/or8 x! B8 C- c; `
  16. * modify it under the terms of the GNU General Public License as
    8 n+ U( K: B$ T4 }7 `
  17. * published by the Free Software Foundation version 2.
    5 n: o& F( b( x
  18. *
    ' S4 g. a( z% U: c# ?% t" B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) C* F! Z7 j. s; C5 L% Q7 g
  20. * kind, whether express or implied; without even the implied warranty
    3 i7 s( H: d/ s6 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; O4 i0 w' i+ Z0 _+ A; Y2 L
  22. * GNU General Public License for more details.* v1 q* E* ~* z" i/ h6 F
  23. */1 ]8 s3 Y- |% K

  24. . t+ `$ H) }3 D- {+ @( w7 k; M
  25. #include <linux/module.h>
    5 s! L3 `2 ^2 h$ M0 s) p6 o7 q
  26. #include <linux/init.h>- O: |- ^- [6 A* b1 K2 N
  27. #include <linux/errno.h>
    6 n& o1 D( T4 \1 f+ M
  28. #include <linux/types.h>- u( Z4 F! l$ h! G( @
  29. #include <linux/interrupt.h>: a1 ]6 u, z, h
  30. #include <asm/io.h>3 P# A# W+ r& c8 m& e$ \
  31. #include <linux/moduleparam.h>
    4 p) |% J% g0 u' ?+ p8 y. @5 T
  32. #include <linux/sysctl.h>
    ; l" ^" E4 ]- e, p
  33. #include <linux/mm.h>3 A/ S9 C9 g  j& s9 h
  34. #include <linux/dma-mapping.h>0 f+ B; k+ _% k
  35. 5 Z* a4 j! a2 E' U' h! K
  36. #include <mach/memory.h>; M& A! }/ O4 W
  37. #include <mach/hardware.h>
    3 ^1 ^$ L1 Q: v2 T- x2 W: \
  38. #include <mach/irqs.h>' Y7 b- ~& N* R2 A
  39. #include <asm/hardware/edma.h>
    ; x5 J8 A! C( V2 k. n( A" f. T

  40. 9 G& a7 ^& I  i* g
  41. #undef EDMA3_DEBUG) i) h, t- M, A4 Z: \0 a5 G
  42. /*#define EDMA3_DEBUG*/
    5 m2 B' R3 O3 b& \  B
  43. , @2 @7 y5 d, t- [1 c
  44. #ifdef EDMA3_DEBUG
    9 n* \+ F, V( p8 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # t. _! y8 t1 E$ o  E6 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( J  F$ [4 T, ]; |! ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 s; |0 j8 }3 [5 o& {1 r( n8 |
  48. #else
    6 ^$ O0 b- S- `  M+ W2 m
  49. #define DMA_PRINTK( x... )+ k2 w5 s9 P9 l' S  t! J
  50. #define DMA_FN_IN4 \: x9 M- t. o0 Q+ G' a5 Z
  51. #define DMA_FN_OUT5 t' I2 O, ~/ X  G, D
  52. #endif8 c# E% }6 i0 i6 }8 ]9 `% b$ b1 M

  53. 8 W8 n8 Z) ^) s6 m1 c# A6 }$ a. Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Z% F" [# `8 f
  55. #define STATIC_SHIFT                3
    5 u2 g, S/ p  t1 s- M# I$ }* T
  56. #define TCINTEN_SHIFT               20
    ; V; v0 I* ?* J% Y6 E% v: r! j' I
  57. #define ITCINTEN_SHIFT              216 p9 q, J! h- z7 z
  58. #define TCCHEN_SHIFT                229 b8 a0 f7 U4 M7 C# D
  59. #define ITCCHEN_SHIFT               231 P. I; t2 f% R& R" c  Q

  60. / F1 Z- ?: M0 J# R) y
  61. static volatile int irqraised1 = 0;% @5 N  ~8 a3 V# `
  62. static volatile int irqraised2 = 0;9 \8 A) h) J4 q6 m5 p
  63.   B( W2 q. K0 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " X/ j7 O" k1 s) u: T# z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. h/ ~; s  ^* x, i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ]! `- Z1 a  r) v' U! C

  67. ; ]$ m0 V! h! O7 y6 l7 v) A
  68. dma_addr_t dmaphyssrc1 = 0;
    # [! s* O/ {) F: K6 n% D, x
  69. dma_addr_t dmaphyssrc2 = 0;# I, `+ M# y8 a% j' `3 q/ q; g2 t) D
  70. dma_addr_t dmaphysdest1 = 0;. V: c) q: ]! M5 _' Z1 d9 i
  71. dma_addr_t dmaphysdest2 = 0;
    # X0 }, Q. t" ^% V8 J
  72. : R. v" j# B. i2 O1 g, w$ x2 u) J
  73. char *dmabufsrc1 = NULL;
    5 I, q, A0 ?* L( n
  74. char *dmabufsrc2 = NULL;/ Q% V3 P$ G* n( f
  75. char *dmabufdest1 = NULL;
    # r; ?  o5 E2 a1 j. ]. P( c5 D9 k
  76. char *dmabufdest2 = NULL;8 [6 R' u. ]0 S" a$ O

  77. ! \% z0 j9 D0 ^& v# P. L
  78. static int acnt = 512;
    9 y/ D' k, g3 M2 g( e. y
  79. static int bcnt = 8;
    8 E" I. a: \2 B$ W, s1 Z! |5 H
  80. static int ccnt = 8;
      }, F& Y$ w9 Y! \8 m1 [
  81. 2 ?* |# F/ }! o" U3 u2 F
  82. module_param(acnt, int, S_IRUGO);: w, j/ X" a- `3 F- }9 a
  83. module_param(bcnt, int, S_IRUGO);
    ; X6 T! g- c' I. k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& s# K7 f: u! e. p7 P$ t: L6 \; {, }) U; v5 R7 f- T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 g, }7 E# x' S4 p( M8 B2 J0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 V7 Y3 j8 @4 u% _# S9 V* {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% m$ O7 ]& r3 B/ N
0 \) z, Q: ]4 {/ r7 F! _  T3 w
0 u  V/ G" a* o6 E% K# x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 22:37 , Processed in 0.038579 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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