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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e( T  ]7 u; B9 |3 \( v3 v
  1. [code]EDMA sample test application
    / v" x3 m( n  a* @8 G* P* x  B
  2. /*9 {6 ~1 c0 r; O
  3. * edma_test.c
    " X: h8 g+ ^5 p- S5 V& J/ \
  4. *
    5 V2 L$ g+ {& o6 q
  5. * brief  EDMA3 Test Application
    9 J3 Z! A/ i# ?& ~$ a9 l1 ?; |
  6. *8 }( {) @6 l7 c3 ]$ @5 z
  7. *   This file contains EDMA3 Test code.3 P( T2 K% M7 v4 ?
  8. *
    : Y3 n* ~7 y, E& L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 i; U/ o. z6 |! N' p* U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 S2 L' g4 S5 f4 K
  11. *         TO CHANGE.' B' e; _4 N3 ?7 G' J  H
  12. *$ i6 e# D* f" j. R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ L1 d7 K% y  @: M' [. K
  14. *- A. Z$ H& @9 e; F$ w5 S* D: i
  15. * This program is free software; you can redistribute it and/or
    4 I; ^# z; X3 L$ Y# {) ~% j3 Z& @
  16. * modify it under the terms of the GNU General Public License as; B, [" l& P; e3 ]" P1 d8 s& P! h
  17. * published by the Free Software Foundation version 2.
    " X7 Z2 q  k/ |! |- U! i- a
  18. *
    8 m4 s0 z3 a$ g1 {; B( S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 _6 }% e' Y8 L1 T4 D& z
  20. * kind, whether express or implied; without even the implied warranty
    0 x8 l  `/ |( q4 p, z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ~" \7 d; o% |7 `* r4 J% D8 n, W
  22. * GNU General Public License for more details.
    1 h; c/ ?: L3 M4 r
  23. */
    6 s5 `- h7 G7 s/ x3 d9 d
  24. 4 G9 g2 c1 R. ^! }5 O$ B
  25. #include <linux/module.h>
    $ W# g5 ?2 X6 |; T6 W; F
  26. #include <linux/init.h>
    , ^( x: O7 |& {) T
  27. #include <linux/errno.h>* C% P* ~% \0 L8 O4 V
  28. #include <linux/types.h>
    ) E3 g+ ^8 o$ ~: T' ^; n3 b* F
  29. #include <linux/interrupt.h>
    , {7 C2 M- S" ?
  30. #include <asm/io.h>
    9 y& i& \) ]% N5 O8 ?7 Y
  31. #include <linux/moduleparam.h>
    * A5 W5 q/ g; M/ m0 o
  32. #include <linux/sysctl.h>" x; l" s# [; l! X# d
  33. #include <linux/mm.h>% s) C; Z  ]! N1 I! H
  34. #include <linux/dma-mapping.h>5 T2 C! }& C7 h3 y8 e" a

  35. # H( ]0 o0 U" M0 {
  36. #include <mach/memory.h>. i7 u$ ^1 `" F1 ?9 ~$ }
  37. #include <mach/hardware.h>" W" L" y  V' G1 ]
  38. #include <mach/irqs.h>; a+ @, U: U9 M
  39. #include <asm/hardware/edma.h>
    ' L0 Z* _% |3 A
  40. 2 n$ j7 N8 G0 U# m) L
  41. #undef EDMA3_DEBUG
    / K& X7 i7 X7 N& i
  42. /*#define EDMA3_DEBUG*/2 ~' U/ o0 Y& t/ U; I
  43. ; ~9 m: E; H) I3 W; z5 g% k
  44. #ifdef EDMA3_DEBUG
    ( b* ~" }( W7 i0 O. ?, \8 L: s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). M+ S) p1 ~9 }8 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 X+ A; Q" L5 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 j  Z. O; D0 w: r- Q
  48. #else: S2 H, D+ w. x% w9 U- v
  49. #define DMA_PRINTK( x... )8 q/ m/ y$ {0 W  k. N
  50. #define DMA_FN_IN8 X* F3 j/ x) z. }& A% k6 j
  51. #define DMA_FN_OUT
    1 F! @' v4 w. Q5 i! K7 y
  52. #endif4 e% I5 h/ b3 b. ?3 d6 Q
  53. 7 a" J) ~0 L, B7 K2 p$ o8 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 H% |& q1 k# ]6 Q
  55. #define STATIC_SHIFT                3
    . F3 k  d) ]3 z# R5 z9 }6 i' Q
  56. #define TCINTEN_SHIFT               20
    / G, l) b* y& \* }# C0 T
  57. #define ITCINTEN_SHIFT              212 P! R' `: @7 v- o7 v
  58. #define TCCHEN_SHIFT                22$ Q7 ?6 D0 w3 S; K
  59. #define ITCCHEN_SHIFT               237 V/ \/ \7 T$ V8 w6 L7 k

  60. 4 F7 i/ O. Z1 i" e5 f( g
  61. static volatile int irqraised1 = 0;& f" Z/ j' L* D9 L0 G$ |8 F
  62. static volatile int irqraised2 = 0;
    0 s4 D3 L  f) }$ x2 U
  63.   g$ r* h( i; d6 ~2 p5 n' {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 q. F$ {( B; `$ c" x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u4 P4 f/ k. o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?: O9 S2 w+ P
  67. + W9 B+ r0 b8 y5 {' ~! k; j
  68. dma_addr_t dmaphyssrc1 = 0;: S9 B2 r, F* u. v
  69. dma_addr_t dmaphyssrc2 = 0;6 B; W! M3 B6 G+ F/ b" _
  70. dma_addr_t dmaphysdest1 = 0;
    5 q4 u7 E  L, j: ]& O
  71. dma_addr_t dmaphysdest2 = 0;( e* p+ q1 v5 y( B/ o& \
  72. 7 N$ J( w. C( a( o
  73. char *dmabufsrc1 = NULL;
    + U' c4 V3 r7 B( P' V5 v0 e
  74. char *dmabufsrc2 = NULL;
    4 z7 ~, z( M  k* v5 X
  75. char *dmabufdest1 = NULL;0 }5 A6 e9 G) {0 z0 Q% K7 e
  76. char *dmabufdest2 = NULL;6 x- [+ L+ `/ D" D! x# J  m8 F

  77. % ]: ^0 L* \. {( |* Z2 b# m
  78. static int acnt = 512;9 A( d; S" W- c( Z. i8 `
  79. static int bcnt = 8;
    ( [  R: t6 y1 J# b+ K( c
  80. static int ccnt = 8;
    ) }0 z: B5 v8 U, c& k
  81. 8 v# c  y, ~2 _# D. ]7 T
  82. module_param(acnt, int, S_IRUGO);
    3 X0 R- T/ A# R% M4 v
  83. module_param(bcnt, int, S_IRUGO);
    + \9 e- y: S, S8 F( E! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& z5 d# E1 r2 s3 b9 i4 `
/ ^4 W$ i3 j+ J8 \1 I: G. G2 ]4 V2 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 H0 b+ x) m# s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ]. L+ }! R7 g/ k, `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& c1 l# j  v1 {5 Q7 A

/ C3 m$ p+ c, I  \8 f9 E: p. B" @5 J+ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 10:28 , Processed in 0.039787 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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